package com.handinfo.android.game;

import java.io.DataInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.LineNumberReader;
import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PointF;
import android.view.MotionEvent;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;

import com.handinfo.android.DWGameActivity;
import com.handinfo.android.DWGameManager;
import com.handinfo.android.core.graphics.DWBitmap;
import com.handinfo.android.core.graphics.DWFont;
import com.handinfo.android.core.graphics.DWGraphics;
import com.handinfo.android.core.net.BaseConnection;
import com.handinfo.android.core.net.DWConnectionCreator;
import com.handinfo.android.core.net.GameProtocol;
import com.handinfo.android.core.object.AbstractGameHandler;
import com.handinfo.android.core.object.Actor;
import com.handinfo.android.core.object.Animation;
import com.handinfo.android.core.resource.DWSerializableFactory;
import com.handinfo.android.core.resource.ResHead;
import com.handinfo.android.core.resource.Resource;
import com.handinfo.android.core.resource.ResourceManager;
import com.handinfo.android.core.resource.ResourceVerifier;
import com.handinfo.android.game.particle.Particle;
import com.handinfo.android.game.particle.ParticleConstants;
import com.handinfo.android.ui.UIWindows;
import com.handinfo.android.uicontrols.DWCharsDetection;
import com.handinfo.android.uicontrols.DWControlTools;
import com.handinfo.android.uicontrols.DWControlsManager;
import com.handinfo.android.uicontrols.DWListener;
import com.handinfo.android.uicontrols.controls.DWAnimationBox;
import com.handinfo.android.uicontrols.controls.DWBackground;
import com.handinfo.android.uicontrols.controls.DWButton;
import com.handinfo.android.uicontrols.controls.DWCheckbox;
import com.handinfo.android.uicontrols.controls.DWControl;
import com.handinfo.android.uicontrols.controls.DWFrame;
import com.handinfo.android.uicontrols.controls.DWImageBox;
import com.handinfo.android.uicontrols.controls.DWInputBox;
import com.handinfo.android.uicontrols.controls.DWLabel;
import com.handinfo.android.uicontrols.controls.DWListSubItem;
import com.handinfo.android.uicontrols.controls.DWListbox;
import com.handinfo.android.uicontrols.controls.DWMessageBox;
import com.handinfo.android.uicontrols.controls.DWPopMenu;
import com.handinfo.android.uicontrols.controls.DWTextbox;
import com.handinfo.android.uicontrols.controls.DWTitle;
//import com.handinfo.android.utils.ChannelOperation;
import com.handinfo.android.utils.DWChannel;
import com.handinfo.android.utils.Tools;

public class Login extends AbstractGameHandler
{
	public int mWaitingCommandId = -1; // 某些指令发送后，客户端处于等待状态

	public static String m_login_name = "xxxxxx1";
	public static String m_login_password = "修改密码";

	private boolean m_Auth_state = false;

	public int DLstate = 0;

	public static boolean m_icon_flag_1 = true;//定时活动是否有开启图标 true是无
	public static boolean m_icon_flag_2 = true;//运营的
	public static boolean m_icon_more_flag_1 = true;//more代表全服的
	public static boolean m_icon_more_flag_2 = true;

	// public int mState = 0;// 登录跳转状态
	// /** 登录状态 - 登录界面,服务器界面,人物界面 */
	// public int m_user_state = -1;
	// /** 下一个登录状态 */
	// private int m_next_user_state = -1;
	// /** 用户中心状态 - logo */
	// public static final byte STATE_LOGO = 0;
	// /** 用户中心状态 - 加载中 */
	// public static final byte STATE_LOADING = 1;
	// /** 用户中心状态 - 主界面 */
	// public static final byte STATE_LOGIN_MAIN = 2;
	// /** 用户中心状态 - 注册账号 */
	// private final byte STATE_LOGIN_REG = 3;
	// /** 用户中心状态 - 登录游戏 */
	// private final byte STATE_LOGIN_LOGIN = 4;
	// /** 用户中心状态 - 帮助关于 */
	// private final byte STATE_LOGIN_HELP = 5;
	// /** 用户中心状态 - 账号充值 */
	// private final byte STATE_LOGIN_TOPUP = 6;
	// /** 用户中心状态 - 修复游戏 */
	// private final byte STATE_LOGIN_REPAIT = 7;
	// /** 用户中心状态 - 游戏设置 */
	// private final byte STATE_LOGIN_SET = 8;
	// /** 用户中心状态 - 人物界面 */
	// private final byte STATE_LOGIN_ROLES = 9;
	// /** 用户中心状态 - 服务器界面 */
	// private final byte STATE_LOGIN_SERVER = 10;
	// /** 用户中心状态 - 创建人物界面 */
	// private final byte STATE_LOGIN_CREATE = 11;
	// /** 用户中心状态 - 返回选择人物 */
	// public static final byte STATE_LOGIN_BACK = 12;
	// /** 用户中心状态 - 资源异常界面 */
	// public static final byte STATE_LOGIN_EXCEPTION = 13;
	// /** 用户中心状态 - 声音界面 */
	// public static final byte STATE_LOGIN_SOUND = 14;
	// /** 用户中心状态 - 第一次注册 */
	// public static final byte STATE_LOGIN_NEW_REG = 15;
	// /** 用户中心状态 - 第一次登录 */
	// public static final byte STATE_LOGIN_NEW_LOGIN = 16;

	// public boolean lock = true;

	// private int[] f_size = {10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
	// 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66,
	// 68, 70, 72, 74, 76};
	// private DWFont[] f_list = new DWFont[f_size.length];

	public static final int STATUS_MAIN = 0;//主界面
	public static final int STATUS_ROLES = 1;//人物
	public static final int STATUS_CREATE = 2;//创建
	public static final int STATUS_SERVER = 3;//服务器
	public static final int STATUS_REGISTER = 4;//注册
	public static final int STATUS_BINDING = 5;//绑定
	public static final int STATUS_UNBIND = 6;//解除绑定
	public static final int STATUS_CHANGE_PASSWORD = 7;//修改密码
	public static final int STATUS_FORGOT_PASSWORD = 8;//找回密码
	public static final int STATUS_SETTING = 9;//游戏设置
	public static final int STATUS_SOUND = 10;//声音
	public static final int STATUS_WAIT_SERVER = 11;//等待服务器重新认证
	public static final int STATUS_WAIT_LOGIN = 12;//等待登陆
	public static final int STATUS_WAIT_QUICK = 13;//等待快速进入游戏

	private int m_status = -1;
	private int m_next_status = STATUS_WAIT_LOGIN;

	public String m_input_box_1 = "";
	public String m_input_box_2 = "";
	public boolean m_check_box_flag = true;
	private boolean m_zhanghao_isHave = true;

	public void setNextStatus(int status)
	{
		m_next_status = status;
	}

	private int currentFrameIndex;

	public void paint(DWGraphics g)
	{
		StringBuffer dotNum = new StringBuffer();
		dotNum.append(" .");
		for (int i = 1; i < (currentFrameIndex / 8); i++) {
			dotNum.append(" .");
		}
		if (currentFrameIndex == 79) {
			currentFrameIndex = 0;
		}
		if (m_status == STATUS_WAIT_LOGIN) {
			g.setClip(0, 0, DWGameManager.Screen_Width, DWGameManager.Screen_Height);
			g.drawBitmap(m_cr_dbj, 0, 0, DWGameManager.Screen_Width, DWGameManager.Screen_Height, DWGraphics.LEFT
					| DWGraphics.TOP);
			if (DWGameManager.AdpaterType == DWGameManager.AD_HIGH) {
				g.drawBitmap(m_cr_logo, DWGameManager.Screen_Width / 2, 50, m_cr_logo.getWidth() * (float) 1.5,
						m_cr_logo.getHeight() * (float) 1.5, DWGraphics.TOP | DWGraphics.HCENTER);
			}
			else {
				g.drawBitmap(m_cr_logo, DWGameManager.Screen_Width / 2, 50, DWGraphics.TOP | DWGraphics.HCENTER);
			}
			DWControlsManager.getInstance().paintMessageBox(g);
		}
		else {
			DWControlsManager.getInstance().paint(g);
		}
		UIWindows.getInstance().drawBaGua(g);
		g.setClip(0, 0, DWGameManager.Screen_Width, DWGameManager.Screen_Height);
		if (m_status == STATUS_WAIT_LOGIN || m_status == STATUS_WAIT_QUICK || m_status == STATUS_WAIT_SERVER) {
			if (m_connectionCreator == null) {
				if (m_status == STATUS_WAIT_LOGIN) {
					g.drawShadowString("联网中 ,请稍候 " + dotNum.toString(), Color.BLACK,
							Color.WHITE, 20, (DWGameManager.Screen_Height - 20),
							Tools.LEFT_BOTTOM);
				}
				else if (m_status == STATUS_WAIT_QUICK) {
					g.drawShadowString("快速进入中 ,请稍候 " + dotNum.toString(), Color.BLACK,
							Color.WHITE, 20, (DWGameManager.Screen_Height - 20),
							Tools.LEFT_BOTTOM);
				}
				else if (m_status == STATUS_WAIT_SERVER) {
					g.drawShadowString("重新认证中 ,请稍候 " + dotNum.toString(), Color.BLACK,
							Color.WHITE, 20, (DWGameManager.Screen_Height - 20),
							Tools.LEFT_BOTTOM);
				}
			}
			else if (m_connectionCreator.getLiveTime() > DWGameManager.FRAME_PER_SECOND) {
				g.drawShadowString("联网中 ,请稍候 " + dotNum.toString(), Color.BLACK,
						Color.WHITE, 20, (DWGameManager.Screen_Height - 20),
						Tools.LEFT_BOTTOM);
			}
		}
		else if (m_status == STATUS_SERVER) {
			if (m_ttListbox == null || m_ttListbox.getSubItemSize() <= 0) {
				g.drawShadowString("正在获取服务器列表 ,请稍候 " + dotNum.toString(), Color.BLACK,
						Color.WHITE, 20, (DWGameManager.Screen_Height - 20),
						Tools.LEFT_BOTTOM);
			}
		}

		currentFrameIndex++;
	}

	/**
	 * 处理消息
	 */
	public boolean recvMessage(int type, DataInputStream dis) throws Exception
	{
		int order = BaseConnection.s_perseOrderID;
		Tools.debugPrintln("Login 接收到指令号 : " + order);
		try {
			DWGameManager.getInstance().getSendMessage().unlockNetwork(GameMessage.锁_默认);
			switch (order) {
				case GameProtocol.SC_USER_AUTH:
				case GameProtocol.CS_USER_REAUTH:
					recvUserAuthMessage(dis);
					break;
				case GameProtocol.SC_USER_REGISTER:
					recvRegistration(dis);
					break;
				case GameProtocol.SC_USER_CHANGE_PASSWORD:
					Tools.debugPrintln("修改密码：" + GameProtocol.SC_USER_CHANGE_PASSWORD);
					recvChangePassword(dis);
					break;
				case GameProtocol.SC_USER_BINDING:
					Tools.debugPrintln("账号绑定：" + GameProtocol.SC_USER_BINDING);
					recvAccountBinding(dis);
					break;
				case GameProtocol.SC_USER_UNBIND:
					Tools.debugPrintln("账号解除绑定：" + GameProtocol.SC_USER_UNBIND);
					recvAccountUnbind(dis);
					break;
				case GameProtocol.SC_USER_RETRIEVE_PASSWORD:
					Tools.debugPrintln("找回密码：" + GameProtocol.SC_USER_RETRIEVE_PASSWORD);
					recvRetrievePassword(dis);
					break;
				case GameProtocol.SC_USER_ROLE_LIST:
					// DWGameManager.getInstance().getSendMessage().unlockNetwork(GameMessage.锁_默认);
					recvRoleList(dis);
					break;
				// case GameProtocol.SC_USER_WORLD_LIST:
				// recvWorldListMessage(dis);
				// lock = true;
				// mState = 1;
				// break;
				case GameProtocol.SC_USER_SERVER_LIST:
					recvServerListMessage(dis);
					// lock = true;
					// mState = 2;
					break;
				case GameProtocol.SC_USER_SELECT_ROLE:
					recvSelectRoleMessage(dis);
					break;
				case GameProtocol.SC_USER_SELECT_WORLD:
					recvSelectWorldMessage(dis);
					break;
				case GameProtocol.SC_USER_AUTO_REGISTER:
					recvAutoRegister(dis);
					break;
				/**************************** xiaoyingying ****************************/
				case GameProtocol.SC_USER_DELETE_ROLE:
					deleteRole(dis);
					break;
				case GameProtocol.SC_USER_FIND_ROLE:
					cancelDeleteRole(dis);
					break;
				/***************************** xiaoyingying ***************************/
				case GameProtocol.SC_USER_CREATE_ROLE:
					createRole(dis);
					break;
			}
		}
		catch (Exception e) {
			Tools.debug(e);
		}
		return false;
	}

	String mSeverName;// 服务器名字
	byte amount;// 角色数量
	byte state;// 认证状态
	byte status;// 删除角色状态

	/**
	 * 接收世界列表 309
	 *
	 * @param dis
	 * @throws IOException
	 */
	// private void recvWorldListMessage(DataInputStream dis) throws IOException
	// {
	// DWGameManager.getInstance().getSendMessage().unlockNetwork(GameMessage.锁_默认);
	// byte amount = dis.readByte();// 世界数量
	// Tools.debugPrintln("世界数量 : " + amount);
	// mWorldList.clear();
	// for (byte i = 0; i < amount; i++) {
	// Function func = new Function();
	// func.m_id = dis.readInt();// 世界ID
	// func.m_name = dis.readUTF();// 世界名字
	// Tools.debugPrintln("第" + i + "个世界ID : " + func.m_id);
	// Tools.debugPrintln("第" + i + "个世界名字 : " + func.m_name);
	// mWorldList.add(func);
	// }
	// // m_role_lock = false;
	// }

	// //////////////////////////////////////////////////////////////
	// 服务器列表界面
	// //////////////////////////////////////////////////////////////
	/** 服务器列表 */
	public ArrayList<Function> m_server_list = new ArrayList<Function>();
	/** 服务器列表长度 */
	// public byte m_server_amount = 0;
	public static long m_server_session = 0;// 会话标识
	/** 服务器选择下标 */
	private int m_server_select = 0;

	/**
	 * 获得服务器列表 306
	 *
	 * @param dis
	 * @throws IOException
	 */
	public void recvServerListMessage(DataInputStream dis) throws IOException
	{
		if (m_ttListbox != null) {
			m_ttListbox.removeAllSubItem();
		}
		m_server_session = dis.readLong();// 对话标识
		byte serverAmount = dis.readByte();// 服务器数量
		Tools.debugPrintln("对话标识 : " + m_server_session);
		Tools.debugPrintln("服务器数量 : " + serverAmount);
		m_server_list.clear();
		for (byte i = 0; i < serverAmount; i++) {
			Function func = new Function();
			func.m_name = dis.readUTF();// 服务器名字
			Tools.debugPrintln("服务器名字 : " + func.m_name);
			func.m_ip = dis.readUTF();// 服务器IP
			Tools.debugPrintln("服务器IP : " + func.m_ip);
			func.m_port = dis.readShort();// 服务器port
			Tools.debugPrintln("服务器port : " + func.m_port);
			func.m_role_amount = getServerListRoleNum(func.m_ip, func.m_port);
			//func.m_role_amount = dis.readByte();// 服务器角色数量
			Tools.debugPrintln("服务器角色数量 : " + func.m_role_amount);
			func.m_State = dis.readByte();// 1---流畅 2---爆满
			Tools.debugPrintln("服务器状态 : " + func.m_State);
			m_server_list.add(func);
			Tools.debugPrintln("m_server_list长度：" + m_server_list.size());
		}
		// setNextState(STATE_LOGIN_SERVER);
		fuwuqiList();
	}

	/***
	 * 获取服务器角色数量
	 * @param ip
	 * @param post
	 * @return
	 */
	private byte getServerListRoleNum(String ip, int post)
	{
		byte roleNum = 0;
		if (ip != null && post > 0) {
			String key = ip + ":" + String.valueOf(post);
			Tools.debugPrintln("getServerListRoleNum key=" + key);
			SharedPreferences share = DWGameManager.getInstance().getCurrentActivity().getSharedPreferences(
					DWGameManager.SERVERLIST_NAME, ContextWrapper.MODE_PRIVATE);
			if (share != null) {
				if (share.contains(key)) {
					Tools.debugPrintln("getServerListRoleNum true");
				}
				roleNum = (byte) share.getInt(key, 0x000000);
				Tools.debugPrintln("getServerListRoleNum roleNum=" + roleNum);
			}
		}
		return roleNum;
	}

	/***
	 * 写入服务器角色数量
	 * @param num
	 */
	private void writeServerListRoleNum(int num)
	{
		SharedPreferences share = DWGameManager.getInstance().getCurrentActivity().getSharedPreferences(
				DWGameManager.SERVERLIST_NAME, ContextWrapper.MODE_PRIVATE);
		if (share != null) {
			String key = DWGameManager.SERVER_URL + ":" + DWGameManager.SERVER_PORT;
			Tools.debugPrintln("writeServerListRoleNum key=" + key + ";num=" + num);
			share.edit().putInt(key, num).commit();
		}
	}

	/**
	 * 接收选择人物返回信息
	 *
	 * @param type
	 * @param body
	 */
	private void recvSelectRoleMessage(DataInputStream dis) throws IOException
	{
		DWGameManager.getInstance().getSendMessage()
				.unlockNetwork(GameMessage.锁_默认);
		Tools.debugPrintln("选择人物返回信息!");
		byte state = dis.readByte();// 状态 0失败,1成功
		Tools.debugPrintln("状态 : " + state);
		if (state == 1) {
			long id = dis.readLong();// 角色id
			// if (mWorldList != null && mWorldList.size() != 0) {
			// Function func = (Function) mWorldList.get(mRoleWorldSelect);
			DWGameManager.getInstance().getSendMessage().sendUserSelectWorld(0);
			// }
		}
		else {
			// DWGameManager.getInstance().getCurrentActivity().toastMakeText(
			// "选择人物返回状态 : " + state, 1000);
			DWControlsManager.getInstance().removeControl(m_login_Frame);
			DWControlsManager.getInstance().removeControl(m_fwqFrame);
			DWGameManager.getInstance().getSendMessage().sendUserActorList();
			setNextStatus(STATUS_ROLES);
			Tools.debugPrintln("选择人物返回状态 : " + state);
		}
	}

	/**
	 * 读取一个玩家属性
	 *
	 * @param dis
	 * @param vec
	 */
	private boolean readRoleAttribute(DataInputStream dis, Role role)
	{
		boolean flag = false;
		try {
			Tools.debugPrintln("读取一个角色!");
			role.m_gameId = dis.readLong();// ID
			Tools.debugPrintln("ID : " + role.m_gameId);

			role.m_name = dis.readUTF();// 名称
			Tools.debugPrintln("名称 : " + role.m_name);

			role.m_lv = dis.readInt();// 等级
			Tools.debugPrintln("等级 : " + role.m_lv);

			role.m_sex = dis.readByte();// 性别
			Tools.debugPrintln("性别 : " + role.m_sex);

			role.m_vocation = dis.readByte();// 职业
			Tools.debugPrintln("职业 : " + role.m_vocation);

			int size = dis.readByte();
			String[] urls = new String[size];
			for (int i = 0; i < size; i++) {
				urls[i] = role.getFigureName(i, dis.readUTF());
				Tools.debugPrintln("资源地址 : " + i + urls[i]);
			}
			//
			// String url = dis.readUTF();// 资源地址
			// Tools.debugPrintln("资源地址 : " + url);
			//
			// String wuqi = dis.readUTF();
			// Tools.debugPrintln("装备资源地址 : " + wuqi);
			//
			role.m_location = dis.readUTF();// 最后下线场景
			Tools.debugPrintln("下线场景 : " + role.m_location);

			role.m_delete = dis.readByte() == 0 ? false : true;
			Tools.debugPrintln("是否被删除 : " + role.m_delete);
			if (role.m_delete) {
				flag = role.m_delete;
				role.m_keepDay = dis.readInt();
				Tools.debugPrintln("保留剩余天数 : " + role.m_keepDay);
			}
			initRoleRes(role, urls);
		}
		catch (IOException e) {
			e.printStackTrace();
		}
		return flag;
	}

	/**
	 * 读取进入世界
	 *
	 * @param dis
	 * @throws IOException
	 */
	private void recvSelectWorldMessage(DataInputStream dis) throws IOException
	{
		byte state = dis.readByte();// 状态 0失败,1成功
		if (state == 1) {
			DWGameManager.getInstance().getSendMessage()
					.unlockNetwork(GameMessage.锁_默认);
			DWGameManager.getInstance().m_role = new Role(
					DWGameManager.getInstance().m_resourceDynamic);
			DWGameManager.getInstance().m_role.m_gameId = dis.readLong();// 角色ID
			Tools.debugPrintln("角色ID : "
					+ DWGameManager.getInstance().m_role.m_gameId);
			DWControlsManager.getInstance().removeAllControl();
			Loading loading = new Loading();
			DWGameManager.getInstance().setGameHandler(loading);
			DWGameManager.getInstance().setGameState(DWGameManager.GS_LOADING);
			Tools.debugPrintln("游戏主状态："
					+ DWGameManager.getInstance().getGameState());
		}
		else {
			DWGameManager.getInstance().addSystemInfo(
					DWGameManager.SYSTEM_INFO_TYPE_A, "进入世界失败!");
		}
		//注释
//		ChannelOperation.enterGame();
	}

	// role_defs
	public void initRoleRes(Role role, String[] urls)
	{
		if (urls == null || urls.length == 0)
			return;
		role.m_anims = new Animation[urls.length];
		role.m_refsResHead = new ResHead[urls.length];

		for (int i = 0; i < urls.length; i++) {
			if (urls[i] == null || urls[i].length() == 0) {
				role.m_refsResHead[i] = null;
				role.m_anims[i] = null;
				continue;
			}
			role.m_refsResHead[i] = new ResHead();
			role.m_refsResHead[i].m_type = DWSerializableFactory.RESOURCE_TYPE_ANIM;
			role.m_refsResHead[i].m_url = new StringBuffer()
					.append(DWSerializableFactory.DIR_ANIM).append(urls[i])
					.append(DWSerializableFactory.EXTENSION_ANIM).toString();
			role.m_refsResHead[i].m_version = 1;
			role.m_anims[i] = (Animation) (ResourceManager.getInstance()
					.loadResource(mUserResource, role.m_refsResHead[i]));
		}

		role.m_anim = role.m_anims[Role.ANIM_HEAD];
		role.setActionFrame(2, 0);
	}

	/**
	 * 进入场景 715 703
	 *
	 * @param dis
	 * @throws IOException
	 */
	public void enterInto(DataInputStream dis) throws IOException
	{
		short code = dis.readShort();// 确认信息 1--成功 0--失败
		String sceneResKey = dis.readLine();// 场景资源key
		String sceneName = dis.readLine();// 场景名字
		short x = dis.readShort();// X坐标
		short y = dis.readShort();// Y坐标
		byte direction = dis.readByte();// 方向
	}

	// //////////////////////////////////////////////////////////////
	// 人物列表界面
	// //////////////////////////////////////////////////////////////
	private final byte ROLE_LIST_SIZE = 3;// 人物列表数量限制
	private Role[] mRoleList = new Role[ROLE_LIST_SIZE];// 人物列表
	public byte mRoleAmount = 0;// 角色数量
	private byte mRoleSelect = 0;// 人物选择下标
	private Resource mUserResource = new Resource();

	// private ArrayList<Function> mWorldList = new ArrayList<Function>();//
	// 世界列表
	// private byte mRoleWorldSelect = 0;// 世界列表下标
	// //////////////////////////////////////////////////////////////
	// 服务器列表界面
	// //////////////////////////////////////////////////////////////

	private String mServerName = null;// 当前服务器名字

	public synchronized void dispose()
	{
		DWControlsManager.getInstance().removeAllControl();
		if (mRoleList != null) {
			for (int i = 0; i < mRoleList.length; i++) {
				if (mRoleList[i] != null) {
					mRoleList[i].dispose();
					mRoleList[i] = null;
				}
			}
			mRoleList = null;
		}
		if (mUserResource != null) {
			mUserResource.removeAll();
		}

	}

	public void showKeyBoard()
	{
		InputMethodManager imm = (InputMethodManager) DWGameManager
				.getInstance().getCurrentActivity().getBaseContext()
				.getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
	}

	public void logic()
	{
		if (m_next_status > -1) {
			m_status = m_next_status;

			switch (m_status) {
				case STATUS_MAIN://主界面
					if (m_login_Frame == null) {
						dl_login();
					}
					else {
						if (!DWControlsManager.getInstance().contains(m_login_Frame)) {
							DWControlsManager.getInstance().addControl(m_login_Frame);
						}
					}
					m_l_ib1.setText(m_input_box_1);
					m_l_ib2.setText(m_input_box_2);
					m_l_cb.setChecked(m_check_box_flag);
					break;
				case STATUS_ROLES://人物
					DWControlsManager.getInstance().removeAllControl();
					roleLogic();
					break;
				case STATUS_CREATE://创建
					DWControlsManager.getInstance().removeAllControl();
					createPeople();
					break;
				case STATUS_SERVER://服务器

					if (DWControlsManager.getInstance().contains(m_fwqFrame))
					{
						return;
					}
					else {
						if (m_fwqFrame != null) {
							DWControlsManager.getInstance().addControl(m_fwqFrame);
						}
						else {
							fuwuqi();
							fuwuqiList();
						}
					}
					break;
				case STATUS_REGISTER://注册
					DWControlsManager.getInstance().removeAllControl();
					if (m_Register_Frame != null && !DWControlsManager.getInstance().contains(m_Register_Frame)) {
						DWControlsManager.getInstance().addControl(m_Register_Frame);
					}
					else {
						register();
					}
					m_r_ib1.setText("");
					m_r_ib2.setText("");
					m_r_ib3.setText("");
					break;
				case STATUS_BINDING://绑定
					DWControlsManager.getInstance().removeAllControl();
					if (m_Bind_Frame != null && !DWControlsManager.getInstance().contains(m_Bind_Frame)) {
						DWControlsManager.getInstance().addControl(m_Bind_Frame);
					}
					else {
						Bind_on_Account();
					}
					m_bind_ib1.setText(m_l_ib1.getText());
					m_bind_ib2.setText("");
					m_bind_ib3.setText("");
					m_bind_ib4.setText("");
					break;
				case STATUS_UNBIND://解除绑定
					DWControlsManager.getInstance().removeAllControl();
					if (m_UnBind_Frame != null && !DWControlsManager.getInstance().contains(m_UnBind_Frame)) {
						DWControlsManager.getInstance().addControl(m_UnBind_Frame);
					}
					else {
						UnBind();
					}
					m_ub_ib1.setText(m_l_ib1.getText());
					m_ub_ib2.setText("");
					break;
				case STATUS_CHANGE_PASSWORD://修改密码
					DWControlsManager.getInstance().removeAllControl();
					if (m_Update_Frame != null && !DWControlsManager.getInstance().contains(m_Update_Frame)) {
						DWControlsManager.getInstance().addControl(m_Update_Frame);
					}
					else {
						Updatepassword();
					}
					m_u_ib1.setText(m_l_ib1.getText());
					m_u_ib2.setText("");
					m_u_ib3.setText("");
					m_u_ib4.setText("");
					break;
				case STATUS_FORGOT_PASSWORD://找回密码
					DWControlsManager.getInstance().removeAllControl();
					if (m_Retrieve_Frame != null && !DWControlsManager.getInstance().contains(m_Retrieve_Frame)) {
						DWControlsManager.getInstance().addControl(m_Retrieve_Frame);
					}
					else {
						Retrieve();
					}
					m_rt_ib1.setText("");
					m_rt_ib2.setText("");
					break;
				case STATUS_SETTING://游戏设置
					DWControlsManager.getInstance().removeAllControl();
//					if (DWControlsManager.getInstance().contains(UIWindows.getInstance().m_setup.m_stFrame))
//					{
//						return;
//					}
//					else
//					{
//						if (UIWindows.getInstance().m_setup.m_stFrame != null) {
//							DWControlsManager.getInstance().addControl(UIWindows.getInstance().m_setup.m_stFrame);
//						}
//						else {
					UIWindows.getInstance().m_setup.open((byte) 0);
//						}
//					}
					break;
				case STATUS_SOUND://声音
					break;
				case STATUS_WAIT_LOGIN:
					if (m_login_Frame == null) {
						dl_login();
					}
					else {
						if (!DWControlsManager.getInstance().contains(m_login_Frame)) {
							DWControlsManager.getInstance().addControl(m_login_Frame);
						}
					}
					openConnection();
					break;
			}
			m_next_status = -1;
			if (m_status == STATUS_WAIT_LOGIN) {
				if (DWGameManager.getInstance().connectionIsAlive()) {
					//注释
//					if (ChannelOperation.isChannelSDK) {
//						setNextStatus(STATUS_SERVER);
//						ChannelOperation.login();
//					}
//					else
					{
						setNextStatus(STATUS_MAIN);
					}
				}
			}
		}
		if (m_status == STATUS_WAIT_LOGIN || m_status == STATUS_WAIT_QUICK || m_status == STATUS_WAIT_SERVER) {
			if (m_connectionCreator != null) {
				if (m_connectionCreator.getState() == DWConnectionCreator.SUCCESS) {
					if (m_status == STATUS_WAIT_LOGIN) {
						//注释
//						if (ChannelOperation.isChannelSDK) {
//							setNextStatus(STATUS_SERVER);
//							ChannelOperation.login();
//						}
//						else
						{
							setNextStatus(STATUS_MAIN);
						}
					}
					else if (m_status == STATUS_WAIT_QUICK) {
						if (m_back_l_ib1 != null && m_back_l_ib2 != null) {
							DWGameManager.getInstance().getSendMessage().sendUserAuth(
									m_back_l_ib1, m_back_l_ib2, ResourceVerifier.CLIENT_VERSION, DWChannel.CHANNEL, 1);
						}
						else {
							DWGameManager.getInstance().getSendMessage().sendUserAuth(
									m_l_ib1.getText(), m_l_ib2.getText(), ResourceVerifier.CLIENT_VERSION,
									DWChannel.CHANNEL, 0);
						}
						setNextStatus(STATUS_MAIN);
					}
					else if (m_status == STATUS_WAIT_SERVER) {
						DWGameManager.getInstance().getSendMessage().sendUserReauth(
								DWGameManager.getInstance().m_rolename, m_server_session);
						m_Auth_state = true;
						setNextStatus(STATUS_SERVER);
					}
					m_connectionCreator = null;
				}
				else if (m_connectionCreator.getState() == DWConnectionCreator.FAILED) {

					if (m_status == STATUS_WAIT_SERVER) {
						setNextStatus(STATUS_SERVER);
						dealForConnectionException();
					}
					else {
						DWGameManager.dealForConnectionException("连接失败", "无法连接到服务器,请检查网络设置以及状态!", "重试", "退出游戏");
						setNextStatus(STATUS_MAIN);
					}
					m_connectionCreator = null;
				}
				else if (m_connectionCreator.getLiveTime() > DWConnectionCreator.TIME_OUT) {
					if (m_status == STATUS_WAIT_SERVER) {
						setNextStatus(STATUS_SERVER);
						dealForConnectionException();
					}
					else {
						DWGameManager.dealForConnectionException("连接超时", "连接到服务器超时,请检查网络设置以及状态!", "重试", "退出游戏");
						setNextStatus(STATUS_MAIN);
					}
					m_connectionCreator = null;
				}
			}
		}
		if (m_status == STATUS_SERVER) {
			if (DWControlsManager.getInstance().contains(m_fwqFrame))
			{
				if (DWGameManager.getInstance().getSendMessage().isNetLocked(GameMessage.锁_默认)) {
					m_fwqButton01.setBackground(m_fwqBitmap04, false);
				}
				else {
					m_fwqButton01.setBackground(m_fwqBitmap02, false);
				}
			}
		}
		DWControlsManager.getInstance().logic();
		UIWindows.getInstance().logic();
		// DWGraphics g = DWScreen.Instance.getGraphics();
		// g.setClip(0, 0, DWGameManager.Screen_Width,
		// DWGameManager.Screen_Height);
		// g.setColor(Color.BLACK);
		// g.fillRect(0, 0, DWGameManager.Screen_Width,
		// DWGameManager.Screen_Height);
		// paint(g);
		// DWControlsManager.getInstance().execute(g);
		// DWKey.getInstance().drawKeyboardBackground(g);
		// for (int i = 0, x = 0, y = 0; i < f_list.length; i++) {
		// g.setFont(f_list[i]);
		// x = 50 + (i / 6) * (100 + (i / 6) * 10);
		// y = (int)(50 + f_list[i].getFontHeight() * (i % 6));
		// g.drawString(f_size[i] + "号", Tools.WHITE, x, y, Tools.LEFT_TOP);
		// }
	}

	// //////////////////////////////////////////////////
	// 王阳
	// ///////////////////////////////////////////////

	/**
	 * 接收用户中心第一次认证
	 *
	 * @param type
	 * @param body
	 */
	private void recvUserAuthMessage(DataInputStream dis) throws IOException
	{

		DWGameManager.getInstance().getSendMessage().unlockNetwork(GameMessage.锁_默认);
		byte type = dis.readByte();// 1快速注册 其他都是默认
		state = dis.readByte();
		DWGameManager.getInstance().m_rolename = dis.readUTF(); //账号名
		if (state == 2) {
			dis.readByte(); //权限
		}
		Tools.debugPrintln("type=" + type + ";state = " + state);
		switch (state) {
			case 1:
				final DWMessageBox m_messageBox = new DWMessageBox("提示",
						"账号已经在线,是否将对方踢下线?");
				DWControlsManager.getInstance().addControl(m_messageBox);
				m_messageBox.addListener(new DWListener() {
					public void OnDoubleClick()
					{
					}

					public void OnClick()
					{
						if (m_messageBox.getResult() == DWMessageBox.SOFTKEY_OK) {
							DWGameManager.getInstance().getSendMessage()
									.sendUserDisconnectAnother();
						}
						else if (m_messageBox.getResult() == DWMessageBox.SOFTKEY_BACK) {
						}
						DWControlsManager.getInstance().removeControl(
								m_messageBox);
					}
				});
				Tools.debugPrintln("已经登录在线!");
				break;
			case 2:
				if (type == 1) {
					long roleID = getPastIntoRoleID();
					Tools.debugPrintln("roleID =" + roleID);
					if (roleID != 0) {
						Loading.s_progress = 0;
						DWGameManager.getInstance().getSendMessage()
								.sendUserSelectRole(roleID);
						return;
					}
				}
				if (!m_Auth_state) {
					DWGameManager.getInstance().showToast("登录成功!",
							Toast.LENGTH_LONG);
					Tools.debugPrintln("登录成功!");
					//注释
//					if (!ChannelOperation.isChannelSDK)
					{
						wr(DWGameActivity.instance); // /登陆成功之后写入玩家的账号和密码
						write();
						m_l_but7.setBackground(createImage("/img/newui/ksjr_0.gnp"),
								false);
						m_l_but7.setDownImage(createImage("/img/newui/kujr_1.gnp"));
						m_l_but7.addListener(m_kujr_lis);
					}
					DWGameManager.getInstance().getSendMessage()
							.sendUserServerList();
					//注释
//					if (!ChannelOperation.isChannelSDK)
					{
						setNextStatus(STATUS_SERVER);
						DWControlsManager.getInstance().removeControl(m_login_Frame);
					}
				}
				else {
					//注释
//					if (!ChannelOperation.isChannelSDK)
					{
						m_l_but7.setBackground(createImage("/img/newui/ksjr_0.gnp"), false);
						m_l_but7.setDownImage(createImage("/img/newui/kujr_1.gnp"));
						m_l_but7.addListener(m_kujr_lis);
					}
					DWControlsManager.getInstance().removeControl(m_fwqFrame);
					DWGameManager.getInstance().getSendMessage()
							.sendUserActorList();
					DWGameManager.getInstance().m_redundance = dis.readUTF(); //冗余字段
					//注释
//					ChannelOperation.doLoginToken();
					setNextStatus(STATUS_ROLES);
				}
				break;
			case 3:
				DWGameManager.getInstance().showToast("密码错误,若修改密码后未登陆游戏，密码未保存，请输入新密码!", 1000);
				break;
			case 4:
				DWGameManager.getInstance().showToast("用户名错误!", 1000);
				break;
			case 5:
				DWGameManager.getInstance().showToast("账号锁定!", 1000);
				break;
			case 6:
				DWGameManager.getInstance().showToast("账号冻结!", 1000);
				break;
			case 7:
				DWGameManager.getInstance().showToast("其他失败!", 1000);
				break;
			case 8:
				final DWMessageBox m_mb = new DWMessageBox("提示", "请更新客户端，是否退出游戏");
				DWControlsManager.getInstance().addControl(m_mb);
				m_mb.addListener(new DWListener() {
					public void OnDoubleClick()
					{
					}

					public void OnClick()
					{
						if (m_mb.getResult() == DWMessageBox.SOFTKEY_OK) {
							DWGameManager.getInstance().destroy();
						}
						else if (m_mb.getResult() == DWMessageBox.SOFTKEY_BACK) {
						}
						DWControlsManager.getInstance().removeControl(m_mb);
					}
				});
				break;
		}
	}

	/**
	 * 接收自动注册
	 *
	 * @param dis
	 * @throws IOException
	 */
	public String m_register_name = null;// 注册名字
	public String m_register_password1 = null;// 注册密码1

	public void recvAutoRegister(DataInputStream dis) throws IOException
	{
		DWGameManager.getInstance().getSendMessage()
				.unlockNetwork(GameMessage.锁_默认);
		byte status = dis.readByte();
		Tools.debugPrintln("自动注册状态 : " + status);
		if (status == 0) {
			DWGameManager.getInstance().addSystemInfo(
					DWGameManager.SYSTEM_INFO_TYPE_B, "其他错误");
		}
		else if (status == 1) {
			m_register_name = dis.readUTF();
			m_register_password1 = dis.readUTF();
			Tools.debugPrintln("自动注册账号 : " + m_register_name);
			Tools.debugPrintln("自动注册密码 : " + m_register_password1);
			m_input_box_1 = m_register_name;
			m_input_box_2 = m_register_password1;
			m_check_box_flag = m_l_cb.getChecked();
			m_l_ib1.setText(m_register_name);
			m_l_ib2.setText(m_register_password1);
			m_l_but7.setBackground(createImage("/img/newui/ksjr_0.gnp"), false);
			m_l_but7.setDownImage(createImage("/img/newui/kujr_1.gnp"));
			m_l_but7.addListener(m_kujr_lis);
			final DWMessageBox m_mb = new DWMessageBox("注册成功", "账号："
					+ m_register_name + DWControlTools.CHANGE_ROW + "密码："
					+ m_register_password1 + DWControlTools.CHANGE_ROW
					+ "是否进入游戏？", "是", "否");
			DWControlsManager.getInstance().addControl(m_mb);
			m_mb.addListener(new DWListener() {
				public void OnDoubleClick()
				{
				}

				public void OnClick()
				{
					if (m_mb.getResult() == DWMessageBox.SOFTKEY_OK) {
						DWGameManager
								.getInstance()
								.getSendMessage()
								.sendUserAuth(m_register_name,
										m_register_password1,
										ResourceVerifier.CLIENT_VERSION, DWChannel.CHANNEL, 0);
					}
					else if (m_mb.getResult() == DWMessageBox.SOFTKEY_BACK) {
					}
					DWControlsManager.getInstance().removeControl(m_mb);
				}
			});
		}
	}

	/**
	 * 接收注册信息
	 *
	 * @param dis
	 * @throws IOException
	 */
//	public String m_res_name = null;///账号注册成功的保存变量
//	public String m_res_password = null;

	public static SharedPreferences m_sp1_rg;
	public static SharedPreferences m_sp2_rg;
	public static SharedPreferences m_sp3_rg;

	boolean m_flag_rg_write = true;

	private void recvRegistration(DataInputStream dis) throws IOException
	{
		DWGameManager.getInstance().getSendMessage()
				.unlockNetwork(GameMessage.锁_默认);
		status = dis.readByte();
		Tools.debugPrintln("注册状态 : " + status);
		switch (status) {
			case 0:
				DWGameManager.getInstance().showToast("提示: 未知错误!", 1000);
				break;
			case 1:
				m_l_but7.setBackground(createImage("/img/newui/ksjr_0.gnp"), false);
				m_l_but7.setDownImage(createImage("/img/newui/kujr_1.gnp"));
				m_l_but7.addListener(m_kujr_lis);
				final DWMessageBox m_mb = new DWMessageBox("提示",
						"恭喜您,账号注册成功,是否进入游戏!");
				DWControlsManager.getInstance().addControl(m_mb);
				m_mb.addListener(new DWListener() {
					public void OnDoubleClick()
					{
					}

					public void OnClick()
					{
						if (m_mb.getResult() == DWMessageBox.SOFTKEY_OK) {
							DWControlsManager.getInstance().removeControl(m_mb);
							if (m_ckecked_fag) {
								m_input_box_1 = m_r_ib1.getText();
								m_input_box_2 = m_r_ib2.getText();
								m_check_box_flag = m_l_cb.getChecked();
								m_l_ib1.setText(m_r_ib1.getText());
								m_l_ib2.setText(m_r_ib2.getText());
								write();
							}
							DWGameManager.getInstance().getSendMessage().sendUserAuth(m_r_ib1.getText(),
									m_r_ib2.getText(), ResourceVerifier.CLIENT_VERSION, DWChannel.CHANNEL, 0);
							DWControlsManager.getInstance().removeControl(m_Register_Frame);
						}
						else if (m_mb.getResult() == DWMessageBox.SOFTKEY_BACK) {
							DWControlsManager.getInstance().removeControl(m_mb);
							if (DWControlsManager.getInstance().contains(m_Register_Frame)) {
								DWControlsManager.getInstance().removeControl(m_Register_Frame);
							}
							setNextStatus(STATUS_MAIN);
							m_input_box_1 = m_r_ib1.getText();
							m_input_box_2 = m_r_ib2.getText();
							m_check_box_flag = m_l_cb.getChecked();
//							m_res_name = m_r_ib1.getText();
//							m_res_password = m_r_ib2.getText();
						}
					}
				});
				break;
			case 2:
				DWGameManager.getInstance().showToast("提示: 账号里存在非法字符!", 1000);
				break;
			case 3:
				DWGameManager.getInstance().showToast("提示: 非法账号长度!", 1000);
				break;
			case 4:
				DWGameManager.getInstance().showToast("提示: 此账号已经存在,请重新输入一个新账号!",
						1000);
				break;
			case 5:
				DWGameManager.getInstance().showToast("提示: 输入的密码中存在非法字符!", 1000);
				break;
			case 6:
				DWGameManager.getInstance().showToast("提示: 抱歉，您注册账号过多!", 1000);
				break;
		}
	}

	/**
	 * 接收修改密码
	 *
	 * @param dis
	 * @throws IOException
	 */
	private void recvChangePassword(DataInputStream dis) throws IOException
	{
		DWGameManager.getInstance().getSendMessage()
				.unlockNetwork(GameMessage.锁_默认);
		status = dis.readByte();
		switch (status) {
			case 0:
				DWGameManager.getInstance().showToast("提示: 未知错误!", 1000);
				break;
			case 1:
				m_login_password = dis.readUTF();
				final DWMessageBox m_mb = new DWMessageBox("提示", "恭喜您,密码修改成功!");
				DWControlsManager.getInstance().addControl(m_mb);
				m_mb.addListener(new DWListener() {
					public void OnDoubleClick()
					{
					}

					public void OnClick()
					{
						if (m_l_ib1.getText().equals(m_u_ib1.getText())) {
							m_input_box_1 = m_l_ib1.getText();
							m_input_box_2 = m_login_password;
							m_check_box_flag = m_l_cb.getChecked();
						}
						if (m_mb.getResult() == DWMessageBox.SOFTKEY_OK) {
							setNextStatus(STATUS_MAIN);
							DWGameManager.getInstance().addSystemInfo(
									DWGameManager.SYSTEM_INFO_TYPE_B,
									"账号: " + m_u_ib1.getText() + " 新密码: " + m_login_password);
							if (DWControlsManager.getInstance().contains(
									m_Update_Frame)) {
								if (m_Update_Frame != null) {
									DWControlsManager.getInstance().removeControl(
											m_Update_Frame);
								}
							}
						}
						else if (m_mb.getResult() == DWMessageBox.SOFTKEY_BACK) {
							DWGameManager.getInstance().addSystemInfo(
									DWGameManager.SYSTEM_INFO_TYPE_B,
									"账号: " + m_u_ib1.getText() + " 新密码: " + m_login_password);
						}
						DWControlsManager.getInstance().removeControl(m_mb);
					}
				});
				break;
			case 2:
				DWGameManager.getInstance().showToast("提示: 账号错误!", 1000);
				break;
			case 3:
				DWGameManager.getInstance().showToast("提示: 密码错误!", 1000);
				break;
		}
	}

	/**
	 * 接收绑定账号
	 *
	 * @param dis
	 * @throws IOException
	 */
	private void recvAccountBinding(DataInputStream dis) throws IOException
	{
		status = dis.readByte();
		DWGameManager.getInstance().getSendMessage()
				.unlockNetwork(GameMessage.锁_默认);
		switch (status) {
			case 0:
				DWGameManager.getInstance().showToast("提示：未知错误!", 1000);
				break;
			case 1:

				final DWMessageBox mb = new DWMessageBox("提示", "恭喜您,账号绑定成功!");
				DWControlsManager.getInstance().addControl(mb);
				mb.addListener(new DWListener() {
					public void OnDoubleClick()
					{
					}

					public void OnClick()
					{
						if (mb.getResult() == DWMessageBox.SOFTKEY_OK) {
							if (DWControlsManager.getInstance().contains(
									m_Bind_Frame)) {
								if (m_Bind_Frame != null) {
									DWControlsManager.getInstance().removeControl(
											m_Bind_Frame);
								}
							}
							setNextStatus(STATUS_MAIN);
						}
						else if (mb.getResult() == DWMessageBox.SOFTKEY_BACK) {
						}
						DWControlsManager.getInstance().removeControl(mb);
					}
				});
				break;
			case 2:
				DWGameManager.getInstance().showToast("提示：账号错误!", 1000);
				break;
			case 3:
				DWGameManager.getInstance().showToast("提示:密码错误!", 1000);
				break;
			case 4:
				DWGameManager.getInstance().showToast("提示:此账号已经绑定,无需再重复绑定!", 1000);
				break;
		}
	}

	/**
	 * 接收解除绑定
	 *
	 * @param dis
	 * @throws IOException
	 */
	private void recvAccountUnbind(DataInputStream dis) throws IOException
	{
		status = dis.readByte();
		DWGameManager.getInstance().getSendMessage()
				.unlockNetwork(GameMessage.锁_默认);
		switch (status) {
			case 0:
				DWGameManager.getInstance().showToast("提示：未知错误!", 1000);
				break;
			case 1:

				final DWMessageBox m_mb = new DWMessageBox("提示", "账号成功解除绑定!");
				DWControlsManager.getInstance().addControl(m_mb);
				m_mb.addListener(new DWListener() {
					public void OnDoubleClick()
					{
					}

					public void OnClick()
					{
						if (m_mb.getResult() == DWMessageBox.SOFTKEY_OK) {
							if (DWControlsManager.getInstance().contains(
									m_UnBind_Frame)) {
								if (m_UnBind_Frame != null) {
									DWControlsManager.getInstance().removeControl(
											m_UnBind_Frame);
								}
							}
							setNextStatus(STATUS_MAIN);
						}
						else if (m_mb.getResult() == DWMessageBox.SOFTKEY_BACK) {
						}
						DWControlsManager.getInstance().removeControl(m_mb);
					}
				});
				break;
			case 2:
				DWGameManager.getInstance().showToast("提示：账号错误!", 1000);
				break;
			case 3:
				DWGameManager.getInstance().showToast("提示:密码错误!", 1000);
				break;
			case 4:
				DWGameManager.getInstance()
						.showToast("提示:此账号已经解除绑定,不需要重复解除!", 1000);
				break;
		}
	}

	/**
	 * 接收找回密码
	 *
	 * @param dis
	 * @throws IOException
	 */
	private void recvRetrievePassword(DataInputStream dis) throws IOException
	{
		status = dis.readByte();
		DWGameManager.getInstance().getSendMessage()
				.unlockNetwork(GameMessage.锁_默认);
		switch (status) {
			case 0:
				DWGameManager.getInstance().showToast("提示:未知错误!", 1000);
				break;
			case 1:

				final DWMessageBox m_mb = new DWMessageBox("提示", "成功找回密码!");
				DWControlsManager.getInstance().addControl(m_mb);
				m_mb.addListener(new DWListener() {
					public void OnDoubleClick()
					{
					}

					public void OnClick()
					{
						if (m_mb.getResult() == DWMessageBox.SOFTKEY_OK) {
							DWGameManager.getInstance().addSystemInfo(
									DWGameManager.SYSTEM_INFO_TYPE_B,
									"手机短信找回密码尚未开放，请您去邮箱找回密码。");
							if (DWControlsManager.getInstance().contains(
									m_UnBind_Frame)) {
								if (m_UnBind_Frame != null) {
									DWControlsManager.getInstance().removeControl(
											m_UnBind_Frame);
								}
							}
							setNextStatus(STATUS_MAIN);
						}
						else if (m_mb.getResult() == DWMessageBox.SOFTKEY_BACK) {
						}
						DWControlsManager.getInstance().removeControl(m_mb);
					}
				});
				break;
			case 5:
				DWGameManager.getInstance().showToast("提示: 与绑定的手机号码不一致!", 1000);
				break;
			case 6:
				DWGameManager.getInstance().showToast("提示: 与绑定的邮箱不一致!", 1000);
				break;
		}
	}

	// //////////////////3个全局变量保存账号和密码的值，以及控制记住账号和密码状态的变量//////////////////////////////////////////////
	public String name = "";
	public String password = "";

	// //////////////////////////////////////王阳-登录主界面////////////////////////////////////////

	// ///大背景
	DWBackground m_dbj_bg = null;
	Bitmap m_cr_dbj = null;
	// ///小背景
	DWBackground m_xbj_bg;

	// /////logo图片
	Bitmap m_cr_logo = null;
	DWImageBox m_logo_ima;
	DWBackground m_logo_bg;

	// //按钮的图片
	Bitmap m_cr_button = null; // /点击前
	Bitmap m_cr_but_bianhou = null;// /点击后

	// ///叉键退出
	Bitmap m_cr_tuichu = null;
	DWImageBox m_tuichu_ima;
	DWButton m_l_but7;
	// //选择框
	public DWCheckbox m_l_cb;
	// /登陆主界面的2个输入框
	public DWInputBox m_l_ib1 = null;
	public DWInputBox m_l_ib2 = null;

	boolean m_flag = true;
	private DWFrame m_login_Frame = null;
	private DWFrame m_Register_Frame = null;
	private DWFrame m_Bind_Frame = null;
	// private DWFrame su_Frame = null;
	private DWFrame m_Update_Frame = null;
	private DWFrame m_Retrieve_Frame = null;
	private DWFrame m_UnBind_Frame = null;

	// private Bitmap[] img_word_list = null;
	// private final String WORD_PATH = "/login/temp/w_";
	// private final String WORD_POSTFIX = ".gnp";
	// private final String[] WORD_LIST = { "qd", "tc", "kq", "gb", "xb", "zy",
	// "zz", "nc", "zh", "mm", "ksjr", "zhzc", "dlyx", "yxsz", "zhgl",
	// "yxbz", "cjjm", "rwjm", "cjjs", "jzzhjmm", "dl", "jryx", "scjs",
	// "fh", "hyjs", "dqrwlb", "fwqlb", };

	private void dl_login()
	{
		ResHead resHead = new ResHead();
		resHead.m_type = DWSerializableFactory.RESOURCE_TYPE_PNG;
		resHead.m_url = "/img/newui/denglubjt_1.gnp";
		resHead.m_version = 1;
		//m_url=/img/newui/denglubjt_1.gnp
		m_cr_dbj = ((DWBitmap) ResourceManager.getInstance().loadResource(
				mUserResource, resHead)).getImage();
		m_cr_logo = createImage("/img/newui/denglulg_1.gnp"); // /////logo图片

		m_cr_button = createImage("/img/newui/anniu_6.gnp"); // //按钮的图片
		m_cr_but_bianhou = createImage("/img/newui/anniu_6ax.gnp"); // //按钮点击后变的图片

		m_cr_tuichu = createImage("/img/newui/fanhuianniu_1.gnp"); // ///叉键退出

		DWGameManager.getInstance().initResource();

		if (m_login_Frame != null) {
			DWControlsManager.getInstance().removeControl(m_login_Frame);
		}
		// /////////画布
		m_login_Frame = new DWFrame(DWGameManager.Screen_Width,
				DWGameManager.Screen_Height);

		// //大背景
		m_dbj_bg = new DWBackground(m_cr_dbj, m_login_Frame.getShowWidth(),
				m_login_Frame.getShowHeight());
		m_dbj_bg.setNearAnchor(m_login_Frame, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		// /////小背景
		m_xbj_bg = new DWBackground(m_dbj_bg.getShowWidth() - 120,
				m_dbj_bg.getShowHeight() - 80);
		m_xbj_bg.setNearAnchor(m_dbj_bg, Tools.LEFT_TOP, Tools.LEFT_TOP,
				(m_dbj_bg.getShowWidth() - m_xbj_bg.getShowWidth()) / 2,
				(m_dbj_bg.getShowHeight() - m_xbj_bg.getShowHeight()) / 2);
		m_xbj_bg.setShow(false);

		// /////退出按键
		m_tuichu_ima = new DWImageBox(m_cr_tuichu);
		m_tuichu_ima.addListener(m_tuichu_lis);
		m_tuichu_ima.setTouchZoomIn(40, 40);
		m_tuichu_ima.setNearAnchor(m_dbj_bg, Tools.RIGHT_TOP, Tools.RIGHT_TOP,
				-20, 5);

		// ////////logo
		m_logo_ima = new DWImageBox(m_cr_logo);
		m_logo_ima.setNearAnchor(m_xbj_bg, Tools.LEFT_TOP,
				Tools.HCENTER_TOP, -m_logo_ima.getShowWidth() / 2, -(m_login_Frame.getShowHeight() - m_xbj_bg
						.getShowHeight()) / 2);

		m_l_cb = new DWCheckbox();
		int m_logo_y = m_logo_ima.getShowHeight() - (m_login_Frame.getShowHeight() - m_xbj_bg.getShowHeight()) / 2;
		int m_y = (m_xbj_bg.getShowHeight() - m_logo_y - 60 - 2 * createImage("/img/newui/dlyx_1.gnp").getHeight()) / 6;
		// ////账号和密码的标签
		DWLabel m_l_lab1 = new DWLabel("账号");
		m_l_lab1.setShowBackground(false);
		m_l_lab1.setShowWideHigh(m_l_lab1.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
//		m_l_lab1.setNearAnchor(m_logo_ima, Tools.LEFT_TOP, Tools.LEFT_BOTTOM,
//				0, 18);
		m_l_lab1.setNearAnchor(m_logo_ima, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, -30, m_y);

		DWLabel m_l_lab2 = new DWLabel("密码");
		m_l_lab2.setShowBackground(false);
		m_l_lab2.setShowWideHigh(m_l_lab2.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
//		m_l_lab2.setNearAnchor(m_l_lab1, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0,
//				30);
		m_l_lab2.setNearAnchor(m_l_lab1, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, m_y);

		DWImageBox ib1 = new DWImageBox(createImage("/img/newui/tiao.gnp"));
		ib1.setNearAnchor(m_l_lab1, Tools.LEFT_VCENTER, Tools.LEFT_VCENTER,
				-20, 0);

		DWImageBox ib2 = new DWImageBox(createImage("/img/newui/tiao.gnp"));
		ib2.setNearAnchor(m_l_lab2, Tools.LEFT_VCENTER, Tools.LEFT_VCENTER,
				-20, 0);

		// ///2个输入框

		// /////第一个输入框
		if (m_back_l_ib1 != null) {
			name = m_back_l_ib1;
		}
		m_l_ib1 = new DWInputBox(220, DWFont.getDefaultFont().getHeight() + 5, m_login_Frame);
		m_l_ib1.setText(name);
		m_l_ib1.setNearAnchor(m_l_lab1, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 20, 0);
		DWTextbox m_l_t_1 = new DWTextbox("(6~11个数字或字母)");
		m_l_t_1.setNearAnchor(m_l_ib1, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER,
				10, 0);

		// ////第二个输入框
		if (m_back_l_ib1 != null) {
			password = m_back_l_ib2;
		}
		m_l_ib2 = new DWInputBox(220, DWFont.getDefaultFont().getHeight() + 5, m_login_Frame);
		m_l_ib2.setPassword(true);
		m_l_ib2.setText(password);
		m_l_ib2.setNearAnchor(m_l_lab2, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 20, 0);
		DWTextbox m_l_t_2 = new DWTextbox("(6~11个数字或字母)");
		m_l_t_2.setNearAnchor(m_l_ib2, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 10, 0);

		// ////记住账号和密码
		m_l_cb.addListener(m_cb_lis);
		m_l_cb.setNearAnchor(m_l_lab2, Tools.RIGHT_TOP, Tools.LEFT_BOTTOM, -5, 2 * m_y);
		m_l_cb.setChecked(m_back_status);

		DWTextbox m_l_tb = new DWTextbox("<mark c=FFBB11>" + "记录账号及密码" + "</mark>");
		m_l_tb.setNearAnchor(m_l_cb, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER,
				5, 0);

		// /////登陆游戏按钮
		DWButton m_l_but3 = new DWButton("登陆游戏",
				createImage("/img/newui/dlyx_0.gnp"));
		m_l_but3.setName(null);
		m_l_but3.setDownImage(createImage("/img/newui/dlyx_1.gnp"));
		m_l_but3.setNearAnchor(m_l_tb, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER,
				(m_xbj_bg.getShowWidth() - 4 * m_l_but3.getShowWidth()) / 5
						+ m_l_but3.getShowWidth() / 2, 0);
		m_l_but3.addListener(m_button3_lis);

		// ////快速注册，快速进入按钮
		m_l_but7 = new DWButton("", createImage("/img/newui/kuzc_0.gnp"));
		m_l_but7.setName(null);
		m_l_but7.setDownImage(createImage("/img/newui/kuzc_1.gnp"));
		m_l_but7.setNearAnchor(m_xbj_bg, Tools.LEFT_BOTTOM, Tools.LEFT_BOTTOM,
				(m_xbj_bg.getShowWidth() - 4 * m_l_but7.getShowWidth()) / 5,
				-15);
		if (m_back_l_ib1 == null) {
			m_l_but7.addListener(m_kuzc_lis);
		}
		else if (m_back_l_ib1 != null) {
			m_l_but7.setBackground(createImage("/img/newui/ksjr_0.gnp"), false);
			m_l_but7.setDownImage(createImage("/img/newui/kujr_1.gnp"));
			m_l_but7.addListener(m_kujr_lis);
		}
		// ////账号注册按钮
		DWButton m_l_but4 = new DWButton("账号注册",
				createImage("/img/newui/zhzc_0.gnp"));
		m_l_but4.setName(null);
		m_l_but4.setDownImage(createImage("/img/newui/zhzc_1.gnp"));
		m_l_but4.setNearAnchor(m_l_but7, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER,
				(m_xbj_bg.getShowWidth() - 4 * m_l_but4.getShowWidth()) / 5, 0);
		m_l_but4.addListener(m_button4_lis);

		// /////账号管理按钮
		DWButton m_l_but5 = new DWButton("账号管理",
				createImage("/img/newui/zhgl_0.gnp"));
		m_l_but5.setName(null);
		m_l_but5.setDownImage(createImage("/img/newui/zhgl_1.gnp"));
		m_l_but5.setNearAnchor(m_l_but4, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER,
				(m_xbj_bg.getShowWidth() - 4 * m_l_but4.getShowWidth()) / 5, 0);
		m_l_but5.addListener(m_button5_lis);

		// /////游戏设置按钮
		DWButton m_l_but6 = new DWButton("游戏设置",
				createImage("/img/newui/yxsz_0.gnp"));
		m_l_but6.setName(null);
		m_l_but6.setDownImage(createImage("/img/newui/yxsz_1.gnp"));
		m_l_but6.setNearAnchor(m_l_but5, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER,
				(m_xbj_bg.getShowWidth() - 4 * m_l_but4.getShowWidth()) / 5, 0);
		m_l_but6.addListener(m_setup_lis);

		//快速注册上的动画
		Animation m_at_zhanghao = UIWindows.createAnimation("/anim/xuanzebolang_2.anim");
		Actor m_ac_zhanghao = new Actor(m_at_zhanghao);
		DWAnimationBox m_zhuce = new DWAnimationBox(m_ac_zhanghao);
		m_zhuce.setShow(false);
		m_zhuce.setTouch(false);
		m_zhuce.setNearAnchor(m_l_but7, Tools.HCENTER_BOTTOM, Tools.HCENTER_VCENTER, 0, 0);
		if (m_zhanghao_isHave) {//有账号密码信息
			m_zhuce.setShow(false);
		}
		else {
			m_zhuce.setShow(true);
		}

		m_login_Frame.addControl(m_dbj_bg);
		m_login_Frame.addControl(m_xbj_bg);
		m_login_Frame.addControl(m_logo_ima);
		m_login_Frame.addControl(m_tuichu_ima);
		m_login_Frame.addControl(ib1);
		m_login_Frame.addControl(ib2);
		m_login_Frame.addControl(m_l_lab1);
		m_login_Frame.addControl(m_l_lab2);
		m_login_Frame.addControl(m_l_ib1);
		m_login_Frame.addControl(m_l_ib2);
		m_login_Frame.addControl(m_l_cb);
		m_login_Frame.addControl(m_l_tb);
		m_login_Frame.addControl(m_l_but3);
		m_login_Frame.addControl(m_l_but4);
		m_login_Frame.addControl(m_l_but5);
		m_login_Frame.addControl(m_l_but6);
		m_login_Frame.addControl(m_l_but7);
		m_login_Frame.addControl(m_l_t_1);
		m_login_Frame.addControl(m_l_t_2);
		m_login_Frame.addControl(m_zhuce);
		DWControlsManager.getInstance().addControl(m_login_Frame);
	}

	// ////////////////////////叉键对应的监听///////////////////////

	private DWListener m_kuzc_lis = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			// //快速注册
			DWGameManager.getInstance().getSendMessage().sendUserAutoRegister();
		}
	};

	private DWListener m_kujr_lis = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			// //快速进入
			String[] temp = getPastInto();
			if (temp != null) {
				Tools.debugPrintln("快速进入 内容符合");
				String ip = temp[0];
				int post = Integer.valueOf(temp[1].trim());

				if (DWGameManager.getInstance().getConnection() == null
						|| !ip.equals(DWGameManager.SERVER_URL)
						|| post != DWGameManager.SERVER_PORT) {
					Tools.debugPrintln("快速进入 断网从链接");
					DWGameManager.getInstance().closeConnection();
					DWGameManager.getInstance().setConnectionServiceInfo(ip, post);
					openConnection();
					setNextStatus(STATUS_WAIT_QUICK);
				}
				else {
					Tools.debugPrintln("快速进入符合，不需要重连,直接进入");
					DWGameManager.getInstance().getSendMessage().unlockNetwork(GameMessage.锁_默认);
					DWGameManager.getInstance().getSendMessage().sendUserAuth(
							m_back_l_ib1, m_back_l_ib2, ResourceVerifier.CLIENT_VERSION, DWChannel.CHANNEL, 1);
				}
			}
			else {
				Tools.debugPrintln("快速进入 内容不符合，走正常登陆逻辑");
				DWGameManager.getInstance().getSendMessage().unlockNetwork(GameMessage.锁_默认);
				DWGameManager.getInstance().getSendMessage().sendUserAuth(
						m_l_ib1.getText(), m_l_ib2.getText(), ResourceVerifier.CLIENT_VERSION, DWChannel.CHANNEL, 0);
			}
		}
	};

	private DWListener m_tuichu_lis = new DWListener() {
		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			final DWMessageBox mb = new DWMessageBox("提示", "您确定要退出?");
			DWControlsManager.getInstance().addControl(mb);
			mb.addListener(new DWListener() {
				public void OnDoubleClick()
				{
				}

				public void OnClick()
				{
					if (mb.getResult() == DWMessageBox.SOFTKEY_OK) {
						DWControlsManager.getInstance().removeControl(mb);
						DWGameManager.getInstance().destroy();
					}
					else if (mb.getResult() == DWMessageBox.SOFTKEY_BACK) {
						DWControlsManager.getInstance().removeControl(mb);
					}
				}
			});
//			m_res_name = null;
//			m_res_password = null;
			m_register_name = null;
			m_register_password1 = null;
		}
	};

	// //////////////////////////////////登录游戏监听/////////////////////////////////////////
	private DWListener m_button3_lis = new DWListener() {
		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			if (m_l_ib1.getText() == null || m_l_ib1.getText().equals("")) {
				DWGameManager.getInstance().showToast("账号不能为空!",
						Toast.LENGTH_LONG);
			}
			else {
				Tools.debugPrintln("账号内容：" + m_l_ib1.getText());
				if (!DWCharsDetection.detectionLetterNumbers(m_l_ib1.getText())) {
					DWGameManager.getInstance().showToast("账号只允许输入数字与字母!",
							Toast.LENGTH_LONG);
				}
				else {
					if (m_l_ib1.getText().length() < 6) {
						DWGameManager.getInstance().showToast("账号不能少于6个字符!",
								Toast.LENGTH_LONG);
					}
					else if (m_l_ib1.getText().length() > 11) {
						DWGameManager.getInstance().showToast("账号不能高于11个字符!",
								Toast.LENGTH_LONG);
					}
					else {
						if (m_l_ib2.getText() == null
								|| m_l_ib2.getText().equals("")) {
							DWGameManager.getInstance().showToast("密码不能为空!",
									Toast.LENGTH_LONG);
						}
						else {
							if (!DWCharsDetection
									.detectionLetterNumbers(m_l_ib2.getText())) {
								DWGameManager.getInstance().showToast(
										"密码只允许输入数字与字母!", Toast.LENGTH_LONG);
							}
							else {
								if (m_l_ib2.getText().length() < 6) {
									DWGameManager.getInstance().showToast(
											"密码不能少于6个字符!", Toast.LENGTH_LONG);
								}
								else if (m_l_ib2.getText().length() > 11) {
									DWGameManager.getInstance().showToast(
											"密码不能高于11个字符!", Toast.LENGTH_LONG);
								}
								else {
									DWGameManager.getInstance().getSendMessage().unlockNetwork(GameMessage.锁_默认);
									DWGameManager.getInstance().getSendMessage().sendUserAuth(
											m_l_ib1.getText(), m_l_ib2.getText(), ResourceVerifier.CLIENT_VERSION,
											DWChannel.CHANNEL, 0);
									if (m_ttListbox != null) {
										m_ttListbox.removeAllSubItem();
									}
								}
							}
						}
					}
				}
			}
		}
	};

	// /////////////////////////////王阳-记住密码监听////////////////////////////////////////

	public static boolean m_ckecked_fag = true;
	private DWListener m_cb_lis = new DWListener() {

		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{
			if (!m_l_cb.getChecked()) {
				m_ckecked_fag = false;
			}
			else {
				m_ckecked_fag = true;
			}
		}
	};
	public static SharedPreferences m_fastIntoIP;
	public static SharedPreferences m_fastIntoPOST;
	public static SharedPreferences m_fastIntoROLEID;
	public static SharedPreferences m_sp1;
	public static SharedPreferences m_sp2;
	public static SharedPreferences m_sp3;

	private void wr(Context context)
	{
		if (m_sp1 == null) {
			m_sp1 = context.getSharedPreferences("com.handinfo.android",
					Context.MODE_PRIVATE);
		}
		if (m_sp2 == null) {
			m_sp2 = context.getSharedPreferences("com.handinfo.android",
					Context.MODE_PRIVATE);
		}
		if (m_sp3 == null) {
			m_sp3 = context.getSharedPreferences("com.handinfo.android",
					Context.MODE_PRIVATE);
		}
		if (m_fastIntoIP == null) {
			m_fastIntoIP = context.getSharedPreferences("com.handinfo.android",
					Context.MODE_PRIVATE);
		}
		if (m_fastIntoPOST == null) {
			m_fastIntoPOST = context.getSharedPreferences(
					"com.handinfo.android", Context.MODE_PRIVATE);
		}
		if (m_fastIntoROLEID == null) {
			m_fastIntoROLEID = context.getSharedPreferences(
					"com.handinfo.android", Context.MODE_PRIVATE);
		}
	}

	public static void writePastInto()
	{
		try {
			m_fastIntoIP.edit().putString("SERVERIP", DWGameManager.SERVER_URL)
					.commit();
			m_fastIntoPOST
					.edit()
					.putString("SERVERPOST",
							String.valueOf(DWGameManager.SERVER_PORT)).commit();
			long roleID = 0;
			if (DWGameManager.getInstance().m_role != null) {
				roleID = DWGameManager.getInstance().m_role.m_gameId;
			}
			m_fastIntoROLEID.edit().putString("ROLEID", String.valueOf(roleID))
					.commit();
			Tools.debugPrintln("m_fastIntoIP=" + DWGameManager.SERVER_URL);
			Tools.debugPrintln("m_fastIntoPOST=" + DWGameManager.SERVER_PORT);
			Tools.debugPrintln("m_fastIntoROLEID=" + roleID);
		}
		catch (Exception e) {
			Tools.debug(e);
		}
	}

	public static String[] getPastInto()
	{
		String[] temp = null;
		String ip = m_fastIntoIP.getString("SERVERIP", null);
		String post = m_fastIntoPOST.getString("SERVERPOST", null);
		String id = m_fastIntoROLEID.getString("ROLEID", null);
		if (ip == null || post == null || id == null) {
			return temp;
		}
		temp = new String[3];
		temp[0] = ip;
		temp[1] = post;
		temp[2] = id;
		return temp;
	}

	public static long getPastIntoRoleID()
	{
		String temp = m_fastIntoROLEID.getString("ROLEID", null);
		return Tools.getLong(temp);
	}

	private void write()
	{
		if (m_l_cb.getChecked() == true) {
			if (m_l_ib1.getText() != null && m_l_ib2.getText() != null) {
				m_sp1.edit().putString("m_l_ib1", m_l_ib1.getText()).commit();
				m_sp2.edit().putString("m_l_ib2", m_l_ib2.getText()).commit();
			}
		}
		m_sp3.edit().putBoolean("m_l_cb", m_l_cb.getChecked()).commit();
	}

	public static String m_back_l_ib1;
	public static String m_back_l_ib2;
	public static boolean m_back_status;

	public static void Read()
	{
		// ///////获取输入框的上次登录信息以及记住账号和密码的状态
		m_back_l_ib1 = m_sp1.getString("m_l_ib1", null);
		m_back_l_ib2 = m_sp2.getString("m_l_ib2", null);
		m_back_status = m_sp3.getBoolean("m_l_cb", true);
	}

	public void Read_read()
	{
		// ///////获取输入框的上次登录信息以及记住账号和密码的状态
		m_back_l_ib1 = m_sp1.getString("m_l_ib1", null);
		m_back_l_ib2 = m_sp2.getString("m_l_ib2", null);
		m_back_status = m_sp3.getBoolean("m_l_cb", true);
		if (m_back_l_ib1 != null && m_back_l_ib2 != null)
		{
			m_input_box_1 = m_back_l_ib1;
			m_input_box_2 = m_back_l_ib2;
			m_check_box_flag = m_back_status;
		}
		else if (m_back_l_ib1 == null && m_back_l_ib2 == null)
		{
			m_input_box_1 = "";
			m_input_box_2 = "";
			m_check_box_flag = m_back_status;
		}
		setNextStatus(STATUS_WAIT_LOGIN);
	}

	private void read()
	{
		// ///////获取输入框的上次登录信息以及记住账号和密码的状态
		m_back_l_ib1 = m_sp1.getString("m_l_ib1", null);
		m_back_l_ib2 = m_sp2.getString("m_l_ib2", null);
		m_back_status = m_sp3.getBoolean("m_l_cb", true);

//		if (m_back_status == true) {
		setNextStatus(STATUS_WAIT_LOGIN);
		if (m_back_l_ib1 != null && m_back_l_ib2 != null)
		{
			m_input_box_1 = m_back_l_ib1;
			m_input_box_2 = m_back_l_ib2;
			m_check_box_flag = m_back_status;
			m_zhanghao_isHave = true;
		}
		else if (m_back_l_ib1 == null && m_back_l_ib2 == null)
		{
			m_input_box_1 = "";
			m_input_box_2 = "";
			m_check_box_flag = m_back_status;
			m_zhanghao_isHave = false;
		}
	}

	// ////////////////////////////王阳-注册/////////////////////////////////////////////
	private DWListener m_button4_lis = new DWListener() {
		// //注册监听，然后进入注册界面
		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			setNextStatus(STATUS_REGISTER);
		}
	};

	DWInputBox m_r_ib1 = null;
	DWInputBox m_r_ib2 = null;
	DWInputBox m_r_ib3 = null;
	Bitmap m_cr_tit = null;
	DWImageBox m_tit_ima;

	private void register()
	{
		m_cr_tit = createImage("/img/newui/zhucezhanghao_1.gnp");
		m_cr_dbj = createImage("/img/newui/denglubjt_1.gnp"); // ///大背景
		m_cr_button = createImage("/img/newui/anniu_6.gnp"); // //按钮的图片
		m_cr_but_bianhou = createImage("/img/newui/anniu_6ax.gnp"); // //按钮点击后变的图片

		m_cr_tuichu = createImage("/img/newui/fanhuianniu_1.gnp"); // ///叉键退出

		// /////////画布
		m_Register_Frame = new DWFrame(DWGameManager.Screen_Width,
				DWGameManager.Screen_Height);

		// //大背景
		m_dbj_bg = new DWBackground(m_cr_dbj, m_Register_Frame.getShowWidth(),
				m_Register_Frame.getShowHeight());
		m_dbj_bg.setNearAnchor(m_Register_Frame, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		// /////小背景
		m_xbj_bg = new DWBackground(m_dbj_bg.getShowWidth() - 200,
				m_dbj_bg.getShowHeight() - 180);
		m_xbj_bg.setNearAnchor(m_dbj_bg, Tools.LEFT_TOP, Tools.LEFT_TOP,
				(m_dbj_bg.getShowWidth() - m_xbj_bg.getShowWidth()) / 2,
				(m_dbj_bg.getShowHeight() - m_xbj_bg.getShowHeight()) / 2);

		// /////标题
		DWTitle m_r_tit = new DWTitle("", m_Register_Frame);
		m_r_tit.setNearAnchor(m_xbj_bg, Tools.LEFT_BOTTOM, Tools.LEFT_TOP, -8,
				0);
		m_r_tit.setShowWideHigh(m_xbj_bg.getShowWidth() + 16,
				m_r_tit.getShowHeight());
		m_tit_ima = new DWImageBox(m_cr_tit);
		m_tit_ima.setNearAnchor(m_r_tit, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		// ////账号和密码 确认密码的标签
		DWLabel m_r_lab1 = new DWLabel("账号");
		m_r_lab1.setBackgroundColor(Tools.ALPHA);
		m_r_lab1.setTextColor(0xFFFFBB11);

		DWLabel m_r_lab2 = new DWLabel("密码");
		m_r_lab2.setBackgroundColor(Tools.ALPHA);
		m_r_lab2.setTextColor(0xFFFFBB11);
		DWLabel m_r_lab3 = new DWLabel("确认密码");
		m_r_lab3.setBackgroundColor(Tools.ALPHA);
		m_r_lab3.setTextColor(0xFFFFBB11);

		m_r_lab1.setShowWideHigh(m_r_lab1.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
		int m_y = (m_xbj_bg.getShowHeight() - m_r_lab1.getShowHeight() * 3 - m_cr_button.getHeight() - 30) / 4;
		m_r_lab1.setNearAnchor(
				m_xbj_bg,
				Tools.LEFT_TOP,
				Tools.LEFT_TOP,
				m_xbj_bg.getShowWidth() / 4,
				m_y);

		m_r_lab2.setShowWideHigh(m_r_lab2.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
		m_r_lab2.setNearAnchor(m_r_lab1, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0,
				m_y);

		m_r_lab3.setShowWideHigh(m_r_lab3.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
		m_r_lab3.setNearAnchor(m_r_lab2, Tools.RIGHT_TOP, Tools.RIGHT_BOTTOM,
				0, m_y);

		// ///3个输入框

		m_r_ib1 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_Register_Frame);
		m_r_ib1.setNearAnchor(m_r_lab1, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 20, 0);
		DWTextbox m_r_t_1 = new DWTextbox("(6~11个数字或字母)");
		m_r_t_1.setNearAnchor(m_r_ib1, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 5, 0);

		m_r_ib2 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_Register_Frame);
		m_r_ib2.setNearAnchor(m_r_lab2, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 20, 0);
		DWTextbox m_r_t_2 = new DWTextbox("(6~11个数字或字母)");
		m_r_t_2.setNearAnchor(m_r_ib2, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER,
				5, 0);

		m_r_ib3 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_Register_Frame);
		m_r_ib3.setNearAnchor(m_r_lab3, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 20, 0);

		DWButton m_r_but1 = new DWButton("注册账号", m_cr_button);
		m_r_but1.setDownImage(m_cr_but_bianhou);
		m_r_but1.addListener(r_button1_lis);
		m_r_but1.setNearAnchor(m_xbj_bg, Tools.RIGHT_BOTTOM,
				Tools.RIGHT_BOTTOM, -20, -30);

		DWButton m_r_but2 = new DWButton("返回登陆", m_cr_button);
		m_r_but2.setDownImage(m_cr_but_bianhou);
		m_r_but2.addListener(r_button2_lis);
		m_r_but2.setNearAnchor(m_xbj_bg, Tools.RIGHT_TOP, Tools.LEFT_BOTTOM,
				m_r_but2.getShowWidth() - (m_Register_Frame.getShowWidth() - m_xbj_bg.getShowWidth()) / 2 + 10, 10);

		m_Register_Frame.addControl(m_dbj_bg);
		m_Register_Frame.addControl(m_xbj_bg);
		m_Register_Frame.addControl(m_r_tit);
		m_Register_Frame.addControl(m_tit_ima);
		m_Register_Frame.addControl(m_r_lab1);
		m_Register_Frame.addControl(m_r_lab2);
		m_Register_Frame.addControl(m_r_lab3);
		m_Register_Frame.addControl(m_r_ib1);
		m_Register_Frame.addControl(m_r_ib2);
		m_Register_Frame.addControl(m_r_ib3);
		m_Register_Frame.addControl(m_r_but1);
		m_Register_Frame.addControl(m_r_but2);
		m_Register_Frame.addControl(m_r_t_1);
		m_Register_Frame.addControl(m_r_t_2);

		DWControlsManager.getInstance().removeControl(m_login_Frame);
		DWControlsManager.getInstance().addControl(m_Register_Frame);
	}

	// ///////////////王阳-注册界面确定监听////////////////////////////
	private DWListener r_button1_lis = new DWListener() {

		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{
			if (m_r_ib1.getText() == null || m_r_ib1.getText().equals("")) {
				DWGameManager.getInstance().addSystemInfo(
						DWGameManager.SYSTEM_INFO_TYPE_B, "账号不能为空!");
			}
			else {
				if (!DWCharsDetection.detectionLetterNumbers(m_r_ib1.getText())) {
					DWGameManager.getInstance().showToast("账号只允许输入字母与数字!",
							Toast.LENGTH_LONG);
				}
				else {
					if (m_r_ib1.getText().length() < 6) {
						DWGameManager.getInstance().showToast("账号不能少于6个字符!",
								Toast.LENGTH_LONG);
					}
					else if (m_r_ib1.getText().length() > 11) {
						DWGameManager.getInstance().showToast("账号不能高于11个字符!",
								Toast.LENGTH_LONG);
					}
					else {
						if (m_r_ib2.getText() == null || m_r_ib2.equals("")) {
							DWGameManager.getInstance().showToast("密码不能为空!",
									Toast.LENGTH_LONG);
						}
						else {
							if (!DWCharsDetection
									.detectionLetterNumbers(m_r_ib2.getText())) {
								DWGameManager.getInstance().showToast(
										"密码只允许输入字母与数字!", Toast.LENGTH_LONG);
							}
							else {
								if (m_r_ib2.getText().length() < 6) {
									DWGameManager.getInstance().showToast(
											"密码不能少于6个字符!", Toast.LENGTH_LONG);
								}
								else if (m_r_ib2.getText().length() > 11) {
									DWGameManager.getInstance().showToast(
											"密码不能高于11个字符!", Toast.LENGTH_LONG);
								}
								else {
									if (m_r_ib3.getText() == null
											|| m_r_ib3.equals("")) {
										DWGameManager.getInstance().showToast(
												"确认密码不能为空!", Toast.LENGTH_LONG);
									}
									else {
										if (!m_r_ib2.getText().equals(
												m_r_ib3.getText())) {
											DWGameManager.getInstance()
													.showToast("确认密码输入错误!",
															Toast.LENGTH_LONG);
										}
										else {
											DWGameManager
													.getInstance()
													.getSendMessage()
													.sendUserRegister(
															m_r_ib1.getText(),
															m_r_ib2.getText());
										}
									}
								}
							}
						}
					}
				}
			}
		}
	};
	// /////////////////////王阳-注册界面返回监听/////////////////////////////////////////////////////
	private DWListener r_button2_lis = new DWListener() {

		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{

			DWControlsManager.getInstance().removeControl(m_Register_Frame);
			setNextStatus(STATUS_MAIN);
			m_input_box_1 = m_l_ib1.getText();
			m_input_box_2 = m_l_ib2.getText();
			m_check_box_flag = m_l_cb.getChecked();
//			if (m_res_name != null) {
//				m_input_box_1 = m_res_name;
//				m_input_box_2 = m_res_password;
//				m_check_box_flag = m_l_cb.getChecked();
//			}
//			else {
//				if (m_register_name != null) {
//					m_input_box_1 = m_register_name;
//					m_input_box_2 = m_register_password1;
//					m_check_box_flag = m_l_cb.getChecked();
//				}
//			}
		}
	};
	// //////////////////////////////////注册界面截止//////////////////////////////////////////

	// //////////////////////////////////////王阳-账号管理菜单显示////////////////////////////////////////////////////
	DWPopMenu m_pm;
	private DWListener m_button5_lis = new DWListener() {

		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{
			if (m_pm != null) {
				DWControlsManager.getInstance().removeControl(m_pm);
			}
			m_pm = new DWPopMenu(
					new String[] { "修改密码", "账号绑定", "找回密码", "解除绑定" },
					m_cr_button);
			m_pm.setDownImage(m_cr_but_bianhou);
			m_pm.addListener(m_pm_lis);
			m_login_Frame.addControl(m_pm);
			m_input_box_1 = m_l_ib1.getText();
			m_input_box_2 = m_l_ib2.getText();
			m_check_box_flag = m_l_cb.getChecked();
		}
	};
	// ////////////////////////王阳-菜单监听//////////////////////////////////////////////////////////
	private DWListener m_pm_lis = new DWListener() {
		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			int index = m_pm.getIndex();
			if (index == 0) {
				// /////index=0进入修改密码
				m_login_Frame.removeControl(m_pm);
				setNextStatus(STATUS_CHANGE_PASSWORD);
			}
			else if (index == 1) {
				// /////index=1进入账号绑定
				//注释
//				if (ChannelOperation.isChannelSDK == true)
//				{
//					DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, "抱歉，您所下载的渠道包无法绑定账号。");
//				}
//				else
				{
					m_login_Frame.removeControl(m_pm);
					setNextStatus(STATUS_BINDING);
				}
			}
			else if (index == 2) {
				// /////index=2进入找回密码
				m_login_Frame.removeControl(m_pm);
				setNextStatus(STATUS_FORGOT_PASSWORD);
			}
			else {
				// /////index=3进入解除绑定
				m_login_Frame.removeControl(m_pm);
				setNextStatus(STATUS_UNBIND);
			}
		}
	};

	// ////////////////////////////////////王阳-修改密码///////////////////////////////
	DWInputBox m_u_ib1;
	DWInputBox m_u_ib2;
	DWInputBox m_u_ib3;
	DWInputBox m_u_ib4;

	public void Updatepassword()
	{
		m_cr_tit = createImage("/img/newui/xiugaimima_1.gnp");
		m_cr_dbj = createImage("/img/newui/denglubjt_1.gnp"); // ///大背景
		m_cr_button = createImage("/img/newui/anniu_6.gnp"); // //按钮的图片
		m_cr_but_bianhou = createImage("/img/newui/anniu_6ax.gnp"); // //按钮点击后变的图片

		m_cr_tuichu = createImage("/img/newui/fanhuianniu_1.gnp"); // ///叉键退出

		// /////////画布
		m_Update_Frame = new DWFrame(DWGameManager.Screen_Width,
				DWGameManager.Screen_Height);
		// //大背景
		m_dbj_bg = new DWBackground(m_cr_dbj, m_Update_Frame.getShowWidth(),
				m_Update_Frame.getShowHeight());
		m_dbj_bg.setNearAnchor(m_Update_Frame, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		// /////小背景
		m_xbj_bg = new DWBackground(m_dbj_bg.getShowWidth() - 200,
				m_dbj_bg.getShowHeight() - 180);
		m_xbj_bg.setNearAnchor(m_dbj_bg, Tools.LEFT_TOP, Tools.LEFT_TOP,
				(m_dbj_bg.getShowWidth() - m_xbj_bg.getShowWidth()) / 2,
				(m_dbj_bg.getShowHeight() - m_xbj_bg.getShowHeight()) / 2);

		// /////标题
		DWTitle m_u_tit = new DWTitle("", m_Update_Frame);
		m_u_tit.setNearAnchor(m_xbj_bg, Tools.LEFT_BOTTOM, Tools.LEFT_TOP, -8,
				0);
		m_u_tit.setShowWideHigh(m_xbj_bg.getShowWidth() + 16,
				m_u_tit.getShowHeight());
		m_tit_ima = new DWImageBox(m_cr_tit);
		m_tit_ima.setNearAnchor(m_u_tit, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		// ////标签

		DWLabel m_u_lab1 = new DWLabel("当前账号");
		m_u_lab1.setBackgroundColor(Tools.ALPHA);
		m_u_lab1.setTextColor(0xFFFFBB11);

		DWLabel m_u_lab2 = new DWLabel("当前密码");
		m_u_lab2.setBackgroundColor(Tools.ALPHA);
		m_u_lab2.setTextColor(0xFFFFBB11);

		DWLabel m_u_lab3 = new DWLabel("新密码");
		m_u_lab3.setBackgroundColor(Tools.ALPHA);
		m_u_lab3.setTextColor(0xFFFFBB11);

		DWLabel m_u_lab4 = new DWLabel("确认新密码");
		m_u_lab4.setBackgroundColor(Tools.ALPHA);
		m_u_lab4.setTextColor(0xFFFFBB11);

		m_u_lab1.setShowWideHigh(m_u_lab1.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
		int m_y = (m_xbj_bg.getShowHeight() - 4 * m_u_lab1.getShowHeight() - m_cr_button.getHeight() - 20) / 5;
		m_u_lab1.setNearAnchor(m_xbj_bg, Tools.LEFT_TOP, Tools.LEFT_TOP, m_xbj_bg.getShowWidth() / 5, m_y);

		m_u_lab2.setShowWideHigh(m_u_lab2.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
		m_u_lab2.setNearAnchor(m_u_lab1, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, m_y);

		m_u_lab3.setShowWideHigh(m_u_lab3.getShowWidth(), m_y);
		m_u_lab3.setNearAnchor(m_u_lab2, Tools.RIGHT_TOP, Tools.RIGHT_BOTTOM,
				0, m_y);

		m_u_lab4.setShowWideHigh(m_u_lab4.getShowWidth(), m_y);
		m_u_lab4.setNearAnchor(m_u_lab3, Tools.RIGHT_TOP, Tools.RIGHT_BOTTOM,
				0, m_y);

		// ///4个输入框

		m_u_ib1 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_Update_Frame);
		m_u_ib1.setNearAnchor(m_u_lab1, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 20, 0);
		m_u_ib1.setText(m_l_ib1.getText());
		DWTextbox m_u_t_1 = new DWTextbox("(6~11个数字或字母)");
		m_u_t_1.setNearAnchor(m_u_ib1, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER,
				5, 0);

		m_u_ib2 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_Update_Frame);
		m_u_ib2.setNearAnchor(m_u_lab2, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 20, 0);
		// m_u_ib2.setText(m_l_ib2.getText());
		DWTextbox m_u_t_2 = new DWTextbox("(6~11个数字或字母)");
		m_u_t_2.setNearAnchor(m_u_ib2, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER,
				5, 0);

		m_u_ib3 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_Update_Frame);
		m_u_ib3.setNearAnchor(m_u_lab3, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 20, 0);
		DWTextbox m_u_t_3 = new DWTextbox("(6~11个数字或字母)");
		m_u_t_3.setNearAnchor(m_u_ib3, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER,
				5, 0);

		m_u_ib4 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_Update_Frame);
		m_u_ib4.setNearAnchor(m_u_lab4, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 20, 0);

		DWButton m_u_but1 = new DWButton("修改密码", m_cr_button);
		m_u_but1.setDownImage(m_cr_but_bianhou);
		m_u_but1.addListener(update_button1_lis);
		m_u_but1.setNearAnchor(m_xbj_bg, Tools.RIGHT_BOTTOM,
				Tools.RIGHT_BOTTOM, -10, -20);

		DWButton m_u_but2 = new DWButton("返回登陆", m_cr_button);
		m_u_but2.setDownImage(m_cr_but_bianhou);
		m_u_but2.addListener(update_button2_lis);
		m_u_but2.setNearAnchor(m_xbj_bg, Tools.RIGHT_TOP, Tools.LEFT_BOTTOM,
				m_u_but2.getShowWidth() - (m_Update_Frame.getShowWidth() - m_xbj_bg.getShowWidth()) / 2 + 10, 10);

		m_Update_Frame.addControl(m_dbj_bg);
		m_Update_Frame.addControl(m_xbj_bg);
		m_Update_Frame.addControl(m_u_tit);
		m_Update_Frame.addControl(m_tit_ima);
		m_Update_Frame.addControl(m_u_lab1);
		m_Update_Frame.addControl(m_u_lab2);
		m_Update_Frame.addControl(m_u_lab3);
		m_Update_Frame.addControl(m_u_lab4);
		m_Update_Frame.addControl(m_u_ib1);
		m_Update_Frame.addControl(m_u_ib2);
		m_Update_Frame.addControl(m_u_ib3);
		m_Update_Frame.addControl(m_u_ib4);
		m_Update_Frame.addControl(m_u_but1);
		m_Update_Frame.addControl(m_u_but2);

		m_Update_Frame.addControl(m_u_t_1);
		m_Update_Frame.addControl(m_u_t_2);
		m_Update_Frame.addControl(m_u_t_3);
		DWControlsManager.getInstance().removeControl(m_login_Frame);
		DWControlsManager.getInstance().addControl(m_Update_Frame);
	}

	// /////////////////王阳-修改密码界面确定按钮监听////////////////
	private DWListener update_button1_lis = new DWListener() {

		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{

			if (m_u_ib1.getText().equals("") || m_u_ib1.getText() == null) {
				DWGameManager.getInstance().showToast("账号不能为空!",
						Toast.LENGTH_LONG);
			}
			else {
				if (!DWCharsDetection.detectionLetterNumbers(m_u_ib1.getText())) {
					DWGameManager.getInstance().showToast("账号只允许输入数字与字母!",
							Toast.LENGTH_LONG);
				}
				else {
					if (m_u_ib1.getText().length() < 6) {
						DWGameManager.getInstance().showToast("账号不能少于6个字符!",
								Toast.LENGTH_LONG);
					}
					else if (m_u_ib1.getText().length() > 11) {
						DWGameManager.getInstance().showToast("账号不能高于11个字符!",
								Toast.LENGTH_LONG);
					}
					else {
						if (m_u_ib2.getText() == null
								|| m_u_ib2.getText().equals("")) {
							DWGameManager.getInstance().showToast("当前密码不能为空!",
									Toast.LENGTH_LONG);
						}
						else {
							if (!DWCharsDetection
									.detectionLetterNumbers(m_u_ib2.getText())) {
								DWGameManager.getInstance().showToast(
										"当前密码只允许输入数字与字母!", Toast.LENGTH_LONG);
							}
							else {
								if (m_u_ib2.getText().length() < 4) {
									DWGameManager.getInstance().showToast(
											"当前密码不能少于4个字符!", Toast.LENGTH_LONG);
								}
								else if (m_u_ib2.getText().length() > 11) {
									DWGameManager.getInstance()
											.showToast("当前密码不能高于11个字符!",
													Toast.LENGTH_LONG);
								}
								else {
									if (m_u_ib3.getText() == null
											|| m_u_ib3.getText().equals("")) {
										DWGameManager.getInstance().showToast(
												"新密码不能为空!", Toast.LENGTH_LONG);
									}
									else {
										if (!DWCharsDetection
												.detectionLetterNumbers(m_u_ib3
														.getText())) {
											DWGameManager.getInstance()
													.showToast(
															"新密码只允许输入数字与字母!",
															Toast.LENGTH_LONG);
										}
										else {
											if (m_u_ib3.getText().length() < 4) {
												DWGameManager
														.getInstance()
														.showToast(
																"新密码不能少于4个字符!",
																Toast.LENGTH_LONG);
											}
											else if (m_u_ib3.getText()
													.length() > 11) {
												DWGameManager
														.getInstance()
														.showToast(
																"新密码不能高于11个字符!",
																Toast.LENGTH_LONG);
											}
											else {
												if (m_u_ib3.getText().equals(
														m_u_ib2.getText())) {
													DWGameManager
															.getInstance()
															.showToast(
																	"新密码不能和当前密码相同!",
																	Toast.LENGTH_LONG);
												}
												else {
													if (m_u_ib4.getText() == null
															|| m_u_ib4
																	.getText()
																	.equals("")) {
														DWGameManager
																.getInstance()
																.showToast(
																		"确认新密码不能为空!",
																		Toast.LENGTH_LONG);
													}
													else {
														if (!m_u_ib4
																.getText()
																.equals(m_u_ib3
																		.getText())) {
															DWGameManager
																	.getInstance()
																	.showToast(
																			"确认新密码输入错误!",
																			Toast.LENGTH_LONG);
														}
														else {
															DWGameManager
																	.getInstance()
																	.getSendMessage()
																	.sendUserChangePassword(
																			m_u_ib1.getText(),
																			m_u_ib2.getText(),
																			m_u_ib3.getText());
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	};
	// //////////////////////////王阳-修改密码界面返回监听////////////////////////////
	private DWListener update_button2_lis = new DWListener() {

		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{

			DWControlsManager.getInstance().removeControl(m_Update_Frame);
			setNextStatus(STATUS_MAIN);
//			if (m_res_name != null) {
//				m_input_box_1 = m_res_name;
//				m_input_box_2 = m_res_password;
//				m_check_box_flag = m_l_cb.getChecked();
//			}
//			else {
//				if (m_register_name != null) {
//					m_input_box_1 = m_register_name;
//					m_input_box_2 = m_register_password1;
//					m_check_box_flag = m_l_cb.getChecked();
//				}
//			}
		}
	};

	// ////////////////////////////////修改密码截止//////////////////////////////////////////////

	// ////////////////////////////////王阳-账号绑定//////////////////////////////////////////////
	DWInputBox m_bind_ib1;
	DWInputBox m_bind_ib2;
	DWInputBox m_bind_ib3;
	DWInputBox m_bind_ib4;

	public void Bind_on_Account()
	{
		m_cr_tit = createImage("/img/newui/zhanghaobangding_1.gnp");
		m_cr_dbj = createImage("/img/newui/denglubjt_1.gnp"); // ///大背景

		m_cr_button = createImage("/img/newui/anniu_6.gnp"); // //按钮的图片
		m_cr_but_bianhou = createImage("/img/newui/anniu_6ax.gnp"); // //按钮点击后变的图片

		m_cr_tuichu = createImage("/img/newui/fanhuianniu_1.gnp"); // ///叉键退出

		// /////////画布
		m_Bind_Frame = new DWFrame(DWGameManager.Screen_Width,
				DWGameManager.Screen_Height);

		// //大背景
		m_dbj_bg = new DWBackground(m_cr_dbj, m_Bind_Frame.getShowWidth(),
				m_Bind_Frame.getShowHeight());
		m_dbj_bg.setNearAnchor(m_Bind_Frame, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		// /////小背景
		m_xbj_bg = new DWBackground(m_dbj_bg.getShowWidth() - 180,
				m_dbj_bg.getShowHeight() - 180);
		m_xbj_bg.setNearAnchor(m_dbj_bg, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		// /////标题
		DWTitle m_bind_tit = new DWTitle("", m_Bind_Frame);
		m_bind_tit.setNearAnchor(m_xbj_bg, Tools.LEFT_BOTTOM, Tools.LEFT_TOP,
				-8, 0);
		m_bind_tit.setShowWideHigh(m_xbj_bg.getShowWidth() + 16,
				m_bind_tit.getShowHeight());
		m_tit_ima = new DWImageBox(m_cr_tit);
		m_tit_ima.setNearAnchor(m_bind_tit, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		// ////标签
		DWLabel m_bind_lab1 = new DWLabel("账号");
		m_bind_lab1.setBackgroundColor(Tools.ALPHA);
		m_bind_lab1.setTextColor(0xFFFFBB11);
		m_bind_lab1.setShowWideHigh(m_bind_lab1.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);

		DWLabel m_bind_lab2 = new DWLabel("密码");
		m_bind_lab2.setBackgroundColor(Tools.ALPHA);
		m_bind_lab2.setTextColor(0xFFFFBB11);
		m_bind_lab2.setShowWideHigh(m_bind_lab2.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);

		DWLabel m_bind_lab3 = new DWLabel("绑定手机号");
		m_bind_lab3.setBackgroundColor(Tools.ALPHA);
		m_bind_lab3.setTextColor(0xFFFFBB11);
		m_bind_lab3.setShowWideHigh(m_bind_lab3.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);

		DWLabel m_bind_lab4 = new DWLabel("绑定邮箱");
		m_bind_lab4.setBackgroundColor(Tools.ALPHA);
		m_bind_lab4.setTextColor(0xFFFFBB11);
		m_bind_lab4.setShowWideHigh(m_bind_lab4.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);

		// ///4个输入框
		m_bind_ib1 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_Bind_Frame);
		m_bind_ib1.setText(m_l_ib1.getText());

		m_bind_ib2 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_Bind_Frame);
		// m_bind_ib2.setText(m_l_ib2.getText());

		m_bind_ib3 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_Bind_Frame);

		m_bind_ib4 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_Bind_Frame);

		DWTextbox m_bind_tb = new DWTextbox("<mark c=55FF00>" +
				"绑定手机号方便您找回自己的账号密码,请仔细确认输入的手机号和邮箱的正确性。" + "</mark>",
				m_bind_ib4.getShowWidth() + m_bind_lab4.getShowWidth() + 150);
		// 标签1 输入框1
		int m_y = (m_xbj_bg.getShowHeight() - 4 * m_bind_lab1.getShowHeight() - m_bind_tb.getShowHeight()
				- m_cr_button.getHeight() - 20) / 6;
		m_bind_lab1.setNearAnchor(
				m_xbj_bg,
				Tools.LEFT_TOP,
				Tools.LEFT_TOP,
				m_xbj_bg.getShowWidth() / 3 - 30, m_y);

		m_bind_ib1.setNearAnchor(m_bind_lab1, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER,
				20, 0);
		DWTextbox m_bind_t_1 = new DWTextbox("(6~11个数字或字母)");
		m_bind_t_1.setNearAnchor(m_bind_ib1, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 5, 0);

		// 标签2 输入框2
		m_bind_lab2.setNearAnchor(m_bind_lab1, Tools.LEFT_TOP,
				Tools.LEFT_BOTTOM, 0, m_y);
		m_bind_ib2.setNearAnchor(m_bind_lab2, Tools.LEFT_TOP, Tools.RIGHT_TOP,
				20, 0);
		DWTextbox m_bind_t_2 = new DWTextbox("(6~11个数字或字母)");
		m_bind_t_2.setNearAnchor(m_bind_ib2, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 5, 0);

		// 标签3 输入框3
		m_bind_lab3.setNearAnchor(m_bind_lab2, Tools.RIGHT_TOP,
				Tools.RIGHT_BOTTOM, 0, m_y);
		m_bind_ib3.setNearAnchor(m_bind_lab3, Tools.LEFT_TOP, Tools.RIGHT_TOP,
				20, 0);

		// 标签4 输入框4
		m_bind_lab4.setNearAnchor(m_bind_lab3, Tools.RIGHT_TOP,
				Tools.RIGHT_BOTTOM, 0, m_y);
		m_bind_ib4.setNearAnchor(m_bind_lab4, Tools.LEFT_TOP, Tools.RIGHT_TOP,
				20, 0);

		// //////////textbox5
		m_bind_tb.setNearAnchor(m_bind_lab4, Tools.LEFT_TOP, Tools.LEFT_BOTTOM,
				-100, m_y);

		// ////按钮
		DWButton m_bind_but1 = new DWButton("绑定账号", m_cr_button);
		m_bind_but1.setDownImage(m_cr_but_bianhou);
		m_bind_but1.addListener(Bind_button1_lis);
		m_bind_but1.setNearAnchor(m_xbj_bg, Tools.RIGHT_BOTTOM,
				Tools.RIGHT_BOTTOM, -10, -20);

		DWButton m_bind_but2 = new DWButton("返回登陆", m_cr_button);
		m_bind_but2.setDownImage(m_cr_but_bianhou);
		m_bind_but2.addListener(Bind_button2_lis);
		m_bind_but2.setNearAnchor(m_xbj_bg, Tools.RIGHT_TOP, Tools.LEFT_BOTTOM,
				m_bind_but2.getShowWidth() - (m_Bind_Frame.getShowWidth() - m_xbj_bg.getShowWidth()) / 2 + 10, 10);

		m_Bind_Frame.addControl(m_dbj_bg);
		m_Bind_Frame.addControl(m_xbj_bg);
		m_Bind_Frame.addControl(m_bind_tit);
		m_Bind_Frame.addControl(m_tit_ima);
		m_Bind_Frame.addControl(m_bind_lab1);
		m_Bind_Frame.addControl(m_bind_lab2);
		m_Bind_Frame.addControl(m_bind_lab3);
		m_Bind_Frame.addControl(m_bind_lab4);
		m_Bind_Frame.addControl(m_bind_ib1);
		m_Bind_Frame.addControl(m_bind_ib2);
		m_Bind_Frame.addControl(m_bind_ib3);
		m_Bind_Frame.addControl(m_bind_ib4);
		m_Bind_Frame.addControl(m_bind_but1);
		m_Bind_Frame.addControl(m_bind_but2);
		m_Bind_Frame.addControl(m_bind_tb);
		m_Bind_Frame.addControl(m_bind_t_1);
		m_Bind_Frame.addControl(m_bind_t_2);

		DWControlsManager.getInstance().removeControl(m_login_Frame);
		DWControlsManager.getInstance().addControl(m_Bind_Frame);
	}

	// ///////////////////////////////////王阳-账号绑定界面确定监听///////////////////////////////////
	private DWListener Bind_button1_lis = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{

			if (m_bind_ib1.getText() == null || m_bind_ib1.getText().equals("")) {
				DWGameManager.getInstance().showToast("账号不能为空!",
						Toast.LENGTH_LONG);
			}
			else {
				if (!DWCharsDetection.detectionLetterNumbers(m_bind_ib1
						.getText())) {
					DWGameManager.getInstance().showToast("账号只允许输入数字与字母!",
							Toast.LENGTH_LONG);
				}
				else {
					if (m_bind_ib1.getText().length() < 6) {
						DWGameManager.getInstance().showToast("账号不能少于6个字符!",
								Toast.LENGTH_LONG);
					}
					else if (m_bind_ib1.getText().length() > 11) {
						DWGameManager.getInstance().showToast("账号不能高于11个字符!",
								Toast.LENGTH_LONG);
					}
					else {
						if (m_bind_ib2.getText() == null
								|| m_bind_ib2.getText().equals("")) {
							DWGameManager.getInstance().showToast("密码不能为空!",
									Toast.LENGTH_LONG);
						}
						else {
							if (!DWCharsDetection
									.detectionLetterNumbers(m_bind_ib1
											.getText())) {
								DWGameManager.getInstance().showToast(
										"密码只允许输入数字与字母!", Toast.LENGTH_LONG);
							}
							else {
								if (m_bind_ib2.getText().length() < 6) {
									DWGameManager.getInstance().showToast(
											"密码不能少于6个字符!", Toast.LENGTH_LONG);
								}
								else if (m_bind_ib2.getText().length() > 11) {
									DWGameManager.getInstance().showToast(
											"密码不能高于11个字符!", Toast.LENGTH_LONG);
								}
								else {
									if (m_bind_ib3.getText() == null
											|| m_bind_ib3.getText().equals("")) {
										DWGameManager.getInstance().showToast(
												"绑定的手机号不能为空!",
												Toast.LENGTH_LONG);
									}
									else {
										if (!DWCharsDetection
												.detectionNumbers(m_bind_ib3
														.getText())) {
											DWGameManager
													.getInstance()
													.showToast(
															"绑定的手机号格式不对，必须全是数字!",
															Toast.LENGTH_LONG);
										}
										else {
											if (m_bind_ib4.getText() == null
													|| m_bind_ib4.getText()
															.equals("")) {
												DWGameManager
														.getInstance()
														.showToast(
																"绑定的邮箱不能为空!",
																Toast.LENGTH_LONG);
											}
											else {
												if (!DWCharsDetection
														.detectionMail(m_bind_ib4
																.getText())) {
													DWGameManager
															.getInstance()
															.showToast(
																	"绑定的邮箱格式不对!",
																	Toast.LENGTH_LONG);
												}
												else {
													DWGameManager
															.getInstance()
															.getSendMessage()
															.sendUserBinding(
																	m_bind_ib1
																			.getText(),
																	m_bind_ib2
																			.getText(),
																	m_bind_ib3
																			.getText(),
																	m_bind_ib4
																			.getText());
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	};
	// /////////////////////////////王阳-账号绑定界面返回监听/////////////////////////////////
	private DWListener Bind_button2_lis = new DWListener() {

		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{

			DWControlsManager.getInstance().removeControl(m_Bind_Frame);
			setNextStatus(STATUS_MAIN);
//			if (m_res_name != null) {
//				m_input_box_1 = m_res_name;
//				m_input_box_2 = m_res_password;
//				m_check_box_flag = m_l_cb.getChecked();
//			}
//			else {
//				if (m_register_name != null) {
//					m_input_box_1 = m_register_name;
//					m_input_box_2 = m_register_password1;
//					m_check_box_flag = m_l_cb.getChecked();
//				}
//			}
		}
	};
	// /////////////////////////////////账号绑定截止////////////////////////////////////////////

	// /////////////////////////////////王阳-找回密码///////////////////////////////////////////
	DWInputBox m_rt_ib1;
	DWInputBox m_rt_ib2;

	public void Retrieve()
	{
		m_cr_tit = createImage("/img/newui/zhaohuizhanghao_1.gnp");
		m_cr_dbj = createImage("/img/newui/denglubjt_1.gnp"); // ///大背景
		m_cr_button = createImage("/img/newui/anniu_6.gnp"); // //按钮的图片
		m_cr_but_bianhou = createImage("/img/newui/anniu_6ax.gnp"); // //按钮点击后变的图片

		m_cr_tuichu = createImage("/img/newui/fanhuianniu_1.gnp"); // ///叉键退出

		// /////////画布
		m_Retrieve_Frame = new DWFrame(DWGameManager.Screen_Width,
				DWGameManager.Screen_Height);

		// //大背景
		m_dbj_bg = new DWBackground(m_cr_dbj, m_Retrieve_Frame.getShowWidth(),
				m_Retrieve_Frame.getShowHeight());
		m_dbj_bg.setNearAnchor(m_Retrieve_Frame, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		// /////小背景
		m_xbj_bg = new DWBackground(m_dbj_bg.getShowWidth() - 200,
				m_dbj_bg.getShowHeight() - 180);
		m_xbj_bg.setNearAnchor(m_dbj_bg, Tools.LEFT_TOP, Tools.LEFT_TOP,
				(m_dbj_bg.getShowWidth() - m_xbj_bg.getShowWidth()) / 2,
				(m_dbj_bg.getShowHeight() - m_xbj_bg.getShowHeight()) / 2);

		// /////标题
		DWTitle m_rt_tit = new DWTitle("", m_Retrieve_Frame);
		m_rt_tit.setNearAnchor(m_xbj_bg, Tools.LEFT_BOTTOM, Tools.LEFT_TOP, -8,
				0);
		m_rt_tit.setShowWideHigh(m_xbj_bg.getShowWidth() + 16,
				m_rt_tit.getShowHeight());
		m_tit_ima = new DWImageBox(m_cr_tit);
		m_tit_ima.setNearAnchor(m_rt_tit, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		// ////账号和密码的标签
		// /标签1
		DWLabel m_rt_lab1 = new DWLabel("已绑定的手机号");
		m_rt_lab1.setBackgroundColor(Tools.ALPHA);
		m_rt_lab1.setTextColor(0xFFFFBB11);
		m_rt_lab1.setShowWideHigh(m_rt_lab1.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);

		// /标签2
		DWLabel m_rt_lab2 = new DWLabel("已绑定的邮箱");
		m_rt_lab2.setBackgroundColor(Tools.ALPHA);
		m_rt_lab2.setTextColor(0xFFFFBB11);
		m_rt_lab2.setShowWideHigh(m_rt_lab2.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);

		// ///2个输入框
		m_rt_ib1 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5,
				m_Retrieve_Frame);
		m_rt_ib2 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5,
				m_Retrieve_Frame);

		// /textbox 3
		DWTextbox m_rt_tb = new DWTextbox("<mark c=55FF00>" + "输入绑定的手机号、绑定的邮箱，请您去邮箱查找密码。" + "</mark>",
				m_rt_ib2.getShowWidth() + m_rt_lab2.getShowWidth() + 130);
		int m_y = (m_xbj_bg.getShowHeight() - 2 * m_rt_lab1.getShowHeight() - m_rt_tb.getShowHeight()
				- m_cr_button.getHeight() - 20) / 4;
		// /1
		m_rt_lab1.setNearAnchor(
				m_xbj_bg,
				Tools.LEFT_TOP, Tools.LEFT_TOP, m_xbj_bg.getShowWidth() / 4, m_y);
		// /2
		m_rt_lab2.setNearAnchor(m_rt_lab1, Tools.RIGHT_TOP, Tools.RIGHT_BOTTOM,
				0, m_y);
		// //3
		m_rt_tb.setNearAnchor(m_rt_lab2, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, -50, m_y);

		// //2个输入框停靠位置
		m_rt_ib1.setNearAnchor(m_rt_lab1, Tools.LEFT_TOP, Tools.RIGHT_TOP, 20,
				0);
		m_rt_ib2.setNearAnchor(m_rt_lab2, Tools.LEFT_TOP, Tools.RIGHT_TOP, 20,
				0);

		// ///////按钮
		DWButton m_rt_but1 = new DWButton("找回密码", m_cr_button);
		m_rt_but1.setDownImage(m_cr_but_bianhou);
		m_rt_but1.addListener(rt_button1_lis);
		m_rt_but1.setNearAnchor(m_xbj_bg, Tools.RIGHT_BOTTOM,
				Tools.RIGHT_BOTTOM, -20, -20);

		DWButton m_rt_but2 = new DWButton("返回登陆", m_cr_button);
		m_rt_but1.setDownImage(m_cr_but_bianhou);
		m_rt_but2.addListener(rt_button2_lis);
		m_rt_but2.setNearAnchor(m_xbj_bg, Tools.RIGHT_TOP, Tools.LEFT_BOTTOM,
				m_rt_but2.getShowWidth() - (m_Retrieve_Frame.getShowWidth() - m_xbj_bg.getShowWidth()) / 2 + 10, 10);

		m_Retrieve_Frame.addControl(m_dbj_bg);
		m_Retrieve_Frame.addControl(m_xbj_bg);
		m_Retrieve_Frame.addControl(m_rt_tit);
		m_Retrieve_Frame.addControl(m_tit_ima);
		m_Retrieve_Frame.addControl(m_rt_but1);
		m_Retrieve_Frame.addControl(m_rt_but2);
		m_Retrieve_Frame.addControl(m_rt_ib1);
		m_Retrieve_Frame.addControl(m_rt_ib2);
		m_Retrieve_Frame.addControl(m_rt_lab1);
		m_Retrieve_Frame.addControl(m_rt_lab2);
		m_Retrieve_Frame.addControl(m_rt_tb);

		DWControlsManager.getInstance().removeControl(m_login_Frame);
		DWControlsManager.getInstance().addControl(m_Retrieve_Frame);
	}

	// //////////////////////王阳-找回密码界面确定监听//////////////////////////////
	private DWListener rt_button1_lis = new DWListener() {

		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{
			if (m_rt_ib1.getText() == null || m_rt_ib1.getText().equals("")) {
				DWGameManager.getInstance().showToast("已绑定的手机号不能为空!",
						Toast.LENGTH_LONG);
			}
			else {
				if (!DWCharsDetection.detectionNumbers(m_rt_ib1.getText())) {
					DWGameManager.getInstance().showToast("已绑定的手机号必须全是数字格式!",
							Toast.LENGTH_LONG);
				}
				else {
					if (m_rt_ib1.getText().length() != 11) {
						DWGameManager.getInstance().showToast("已绑定的手机号格式不对!",
								Toast.LENGTH_LONG);
					}
					else {
						if (m_rt_ib2.getText() == null
								|| m_rt_ib2.getText().equals("")) {
							DWGameManager.getInstance().showToast(
									"已绑定的邮箱不能为空!", Toast.LENGTH_LONG);
						}
						else {
							if (!DWCharsDetection.detectionMail(m_rt_ib2
									.getText())) {
								DWGameManager.getInstance().showToast(
										"已绑定的邮箱格式不对!", Toast.LENGTH_LONG);
							}
							else {
								DWGameManager
										.getInstance()
										.getSendMessage()
										.sendUserRetrievePassword(
												m_rt_ib1.getText(),
												m_rt_ib2.getText());
							}
						}
					}
				}
			}
		}
	};

	// //////////////////////王阳-找回密码界面返回监听//////////////////////////////////////
	private DWListener rt_button2_lis = new DWListener() {

		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{

			DWControlsManager.getInstance().removeControl(m_Retrieve_Frame);
			setNextStatus(STATUS_MAIN);
//			if (m_res_name != null) {
//				m_input_box_1 = m_res_name;
//				m_input_box_2 = m_res_password;
//				m_check_box_flag = m_l_cb.getChecked();
//			}
//			else {
//				if (m_register_name != null) {
//					m_input_box_1 = m_register_name;
//					m_input_box_2 = m_register_password1;
//					m_check_box_flag = m_l_cb.getChecked();
//				}
//			}
		}
	};

	// //////////////////////////////////////////密码找回截止////////////////////////////////////////

	// /////////////////////////////////////王阳-解除绑定/////////////////////////////////////////////

	// public String getPassword(String password) {
	// if (password != null) {
	// String temp = "";
	// for (int i = 0; i < password.length(); i++) {
	// temp += "*";
	// }
	// return temp;
	// }
	// return "";
	// }

	DWInputBox m_ub_ib1;
	DWInputBox m_ub_ib2;

	public void UnBind()
	{
		m_cr_tit = createImage("/img/newui/jiechubangding_1.gnp");
		m_cr_dbj = createImage("/img/newui/denglubjt_1.gnp"); // ///大背景

		m_cr_button = createImage("/img/newui/anniu_6.gnp"); // //按钮的图片
		m_cr_but_bianhou = createImage("/img/newui/anniu_6ax.gnp"); // //按钮点击后变的图片

		m_cr_tuichu = createImage("/img/newui/fanhuianniu_1.gnp"); // ///叉键退出

		// /////////画布
		m_UnBind_Frame = new DWFrame(DWGameManager.Screen_Width,
				DWGameManager.Screen_Height);
		// //大背景
		m_dbj_bg = new DWBackground(m_cr_dbj, m_UnBind_Frame.getShowWidth(),
				m_UnBind_Frame.getShowHeight());
		m_dbj_bg.setNearAnchor(m_UnBind_Frame, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		// /////小背景
		m_xbj_bg = new DWBackground(m_dbj_bg.getShowWidth() - 200,
				m_dbj_bg.getShowHeight() - 180);
		m_xbj_bg.setNearAnchor(m_dbj_bg, Tools.LEFT_TOP, Tools.LEFT_TOP,
				(m_dbj_bg.getShowWidth() - m_xbj_bg.getShowWidth()) / 2,
				(m_dbj_bg.getShowHeight() - m_xbj_bg.getShowHeight()) / 2);
		// /////标题
		DWTitle m_ub_tit = new DWTitle("", m_UnBind_Frame);
		m_ub_tit.setNearAnchor(m_xbj_bg, Tools.LEFT_BOTTOM, Tools.LEFT_TOP, -8,
				0);
		m_ub_tit.setShowWideHigh(m_xbj_bg.getShowWidth() + 16,
				m_ub_tit.getShowHeight());
		m_tit_ima = new DWImageBox(m_cr_tit);
		m_tit_ima.setNearAnchor(m_ub_tit, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		// ////账号和密码的标签
		DWLabel m_ub_lab1 = new DWLabel("已绑定的账号");
		m_ub_lab1.setBackgroundColor(Tools.ALPHA);
		m_ub_lab1.setTextColor(0xFFFFBB11);

		DWLabel m_ub_lab2 = new DWLabel("账号的密码");
		m_ub_lab2.setBackgroundColor(Tools.ALPHA);
		m_ub_lab2.setTextColor(0xFFFFBB11);
		m_ub_lab1.setShowWideHigh(m_ub_lab1.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);

		int m_y = (m_xbj_bg.getShowHeight() - 2 * m_ub_lab1.getShowHeight() - m_cr_button.getHeight() - 30) / 3;
		m_ub_lab1.setNearAnchor(m_xbj_bg, Tools.LEFT_TOP, Tools.LEFT_TOP, m_xbj_bg.getShowWidth() / 4 - 20, m_y);

		m_ub_lab2.setShowWideHigh(m_ub_lab2.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
		m_ub_lab2.setNearAnchor(m_ub_lab1, Tools.RIGHT_TOP, Tools.RIGHT_BOTTOM, 0, m_y);

		// ///2个输入框
		m_ub_ib1 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_UnBind_Frame);
		m_ub_ib1.setText(m_l_ib1.getText());
		m_ub_ib1.setNearAnchor(m_ub_lab1, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 20, 0);

		DWTextbox m_ub_t_1 = new DWTextbox("(6~11个数字或字母)");
		m_ub_t_1.setNearAnchor(m_ub_ib1, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 5, 0);

		m_ub_ib2 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_UnBind_Frame);
		// m_ub_ib2.setText(m_l_ib2.getText());
		m_ub_ib2.setNearAnchor(m_ub_lab2, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 20, 0);

		DWTextbox m_ub_t_2 = new DWTextbox("(6~11个数字或字母)");
		m_ub_t_2.setNearAnchor(m_ub_ib2, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 5, 0);

		DWButton m_ub_but1 = new DWButton("解除绑定", m_cr_button);
		m_ub_but1.setDownImage(m_cr_but_bianhou);
		m_ub_but1.addListener(ub_button1_lis);
		m_ub_but1.setNearAnchor(m_xbj_bg, Tools.RIGHT_BOTTOM,
				Tools.RIGHT_BOTTOM, -20, -30);

		DWButton m_ub_but2 = new DWButton("返回登陆", m_cr_button);
		m_ub_but2.setDownImage(m_cr_but_bianhou);
		m_ub_but2.addListener(ub_button2_lis);
		m_ub_but2.setNearAnchor(m_xbj_bg, Tools.RIGHT_TOP, Tools.LEFT_BOTTOM,
				m_ub_but2.getShowWidth() - (m_UnBind_Frame.getShowWidth() - m_xbj_bg.getShowWidth()) / 2 + 10, 10);

		m_UnBind_Frame.addControl(m_dbj_bg);
		m_UnBind_Frame.addControl(m_xbj_bg);
		m_UnBind_Frame.addControl(m_ub_tit);
		m_UnBind_Frame.addControl(m_tit_ima);
		m_UnBind_Frame.addControl(m_ub_but1);
		m_UnBind_Frame.addControl(m_ub_but2);
		m_UnBind_Frame.addControl(m_ub_ib1);
		m_UnBind_Frame.addControl(m_ub_ib2);
		m_UnBind_Frame.addControl(m_ub_lab1);
		m_UnBind_Frame.addControl(m_ub_lab2);
		m_UnBind_Frame.addControl(m_ub_t_1);
		m_UnBind_Frame.addControl(m_ub_t_2);
		DWControlsManager.getInstance().removeControl(m_login_Frame);
		DWControlsManager.getInstance().addControl(m_UnBind_Frame);
	}

	// /////////////////////////////王阳-解除绑定界面确定监听/////////////////////
	private DWListener ub_button1_lis = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			if (m_ub_ib1.getText() == null || m_ub_ib1.getText().equals("")) {
				DWGameManager.getInstance().showToast("已绑定的账号不能为空!",
						Toast.LENGTH_LONG);
			}
			else {
				if (!DWCharsDetection
						.detectionLetterNumbers(m_ub_ib1.getText())) {
					DWGameManager.getInstance().showToast("已绑定的账号只允许输入数字与字母!",
							Toast.LENGTH_LONG);
				}
				else {
					if (m_ub_ib1.getText().length() < 6) {
						DWGameManager.getInstance().showToast(
								"已绑定的账号不能少于6个字符!", Toast.LENGTH_LONG);
					}
					else if (m_ub_ib1.getText().length() > 11) {
						DWGameManager.getInstance().showToast(
								"已绑定的账号不能高于11个字符!", Toast.LENGTH_LONG);
					}
					else {
						if (m_ub_ib2.getText() == null
								|| m_ub_ib2.getText().equals("")) {
							DWGameManager.getInstance().showToast("账号的密码不能为空!",
									Toast.LENGTH_LONG);
						}
						else {
							if (!DWCharsDetection
									.detectionLetterNumbers(m_ub_ib2.getText())) {
								DWGameManager.getInstance().showToast(
										"账号的密码只允许输入数字与字母!", Toast.LENGTH_LONG);
							}
							else {
								if (m_ub_ib2.getText().length() < 4) {
									DWGameManager.getInstance()
											.showToast("账号的密码不能少于4个字符!",
													Toast.LENGTH_LONG);
								}
								else if (m_ub_ib2.getText().length() > 11) {
									DWGameManager.getInstance().showToast(
											"账号的密码不能高于11个字符!",
											Toast.LENGTH_LONG);
								}
								else {
									DWGameManager
											.getInstance()
											.getSendMessage()
											.sendUserUnbind(m_ub_ib1.getText(),
													m_ub_ib2.getText());
								}
							}
						}
					}
				}
			}
		}
	};

	// //////////////////////////王阳-解除绑定界面返回监听//////////////////////////////
	private DWListener ub_button2_lis = new DWListener() {

		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{

			DWControlsManager.getInstance().removeControl(m_UnBind_Frame);
			setNextStatus(STATUS_MAIN);
//			if (m_res_name != null) {
//				m_input_box_1 = m_res_name;
//				m_input_box_2 = m_res_password;
//				m_check_box_flag = m_l_cb.getChecked();
//			}
//			else {
//				if (m_register_name != null) {
//					m_input_box_1 = m_register_name;
//					m_input_box_2 = m_register_password1;
//					m_check_box_flag = m_l_cb.getChecked();
//				}
//			}
		}

		// /////////////////////////////////////解除绑定截止//////////////////////////////////////////////
	};

	// //////////////////////////////////////////////////////////////
	// /肖莹莺
	// ///////////////////////////////////////////////////////////////
	// ////////////////////////////////////////////////////////////////
	// ///获取数据代码
	// //////////////////////////////////////////////////////////////////
	/**
	 * 获得角色列表 304
	 *
	 * @param dis
	 * @throws IOException
	 */
	public void recvRoleList(DataInputStream dis) throws IOException
	{
		DWGameManager.getInstance().getSendMessage()
				.unlockNetwork(GameMessage.锁_默认);
		mRoleAmount = dis.readByte();// 角色数量
		int writeRoleAmout = mRoleAmount;
		Tools.debugPrintln("角色数量 = " + mRoleAmount);
		if (mRoleList != null) {
			for (int i = 0; i < mRoleList.length; i++) {
				if (mRoleList[i] != null) {
					mRoleList[i].dispose();
					mRoleList[i] = null;
				}
			}
			mRoleList = null;
			mRoleList = new Role[ROLE_LIST_SIZE];
		}
		if (mRoleAmount > 0) {
			for (byte i = 0; i < mRoleAmount; i++) {
				mRoleList[i] = new Role(mUserResource);
				if (readRoleAttribute(dis, mRoleList[i])) {
					writeRoleAmout--;
				}
			}
		}
		writeServerListRoleNum(writeRoleAmout);
		// m_angle_create = 0;
		m_role_lock = false;
		// DWGameManager.getInstance().getSendMessage().sendUserWorldList();
		setNextStatus(STATUS_ROLES);
	}

	/**
	 * 删除角色 317
	 *
	 * @param dis
	 * @throws IOException
	 */
	public void deleteRole(DataInputStream dis) throws IOException
	{
		status = dis.readByte();// 状态 0--失败 1--成功
		keepTime = dis.readInt();// 如果删除成功，有该位(天数)
		if (status == 1) {
			mRoleList[mRoleSelect].m_delete = true;
			int num = 0;
			for (Role role : mRoleList) {
				if (role != null && !role.m_delete) {
					num++;
				}
			}
			writeServerListRoleNum(num);
			DWGameManager.getInstance().showToast("删除成功!", Toast.LENGTH_LONG);
//			m_rolelis_Frame.removeControl(m_rolelis_show[mRoleSelect]);
			addRoleButton(mRoleSelect);
//			m_rolelis_Frame.addControl(m_rolelis_show[mRoleSelect]);
		}
		else
			DWGameManager.getInstance().showToast("删除失败!", Toast.LENGTH_LONG);
	}

	/**
	 * 取消删除角色 318
	 *
	 * @param dis
	 * @throws IOException
	 */
	public void cancelDeleteRole(DataInputStream dis) throws IOException
	{
		status = dis.readByte();// 状态 0--失败 1--成功
		if (status == 1) {
			mRoleList[mRoleSelect].m_delete = false;
			int num = 0;
			for (Role role : mRoleList) {
				if (role != null && !role.m_delete) {
					num++;
				}
			}
			writeServerListRoleNum(num);
			DWGameManager.getInstance().showToast("恢复角色成功!", Toast.LENGTH_LONG);
//			m_rolelis_Frame.removeControl(m_rolelis_show[mRoleSelect]);
			addRoleButton(mRoleSelect);
//			m_rolelis_Frame.addControl(m_rolelis_show[mRoleSelect]);
		}
		else
			DWGameManager.getInstance().showToast("恢复角色失败!", Toast.LENGTH_LONG);
	}

	/******************************************************************************************************/
	// //////////////////////////////////////////////////////////////////
	// 人物列表界面
	// //////////////////////////////////////////////////////////////

	private boolean m_role_lock = true; // 锁定人物列表界面

	private DWBackground m_rolelis_background;
	private DWFrame m_rolelis_Frame = null; // 人物列表界面
	private DWTextbox[] m_rolelis_textbox = new DWTextbox[ROLE_LIST_SIZE];// 显示人物信息
	private DWControl[] m_rolelis_show = new DWControl[ROLE_LIST_SIZE];// 显示任务形象
//	private DWButton[] m_rolelis_button;// 创建人物

	private int keepTime; // 如果删除成功，有该位(天数)
	boolean addreadserver_flag = false;
	boolean m_rolelis_isFirst = true;
	DWTitle m_rolelis_title;
	DWButton m_rolelis_backbutton;// 返登陆界面
	DWBackground m_rolelis_msgBackground[] = new DWBackground[ROLE_LIST_SIZE];// 人物信息框背景
	DWLabel m_rolelis_readserver;
	DWBackground m_rolelis_backgroundImg;
	DWBackground[] m_rolelis_selectBackground;
	DWButton[] m_rolelis_listbox;
	private Bitmap img_delete_role = null; // 删除小人图标
	private Bitmap img_back = null;
	private Bitmap img_back1 = null;
	private Bitmap img_bigBackground = null;
	private Bitmap img_button;
	private Bitmap img_axButton;
	private Bitmap img_selectBround;

	/**
	 * 初始化人物列表界面
	 */
	private void initRoleLogic()
	{
		m_rolelis_buttonMenu = null;
		img_delete_role = createImage("/img/newui/shanchu_xiaoheiren.gnp");
		img_back = createImage("/img/newui/anniu_6.gnp");
		img_back1 = createImage("/img/newui/anniu_6ax.gnp");
		img_bigBackground = createImage("/img/newui/denglubjt_1.gnp");
		img_button = createImage("/img/newui/anniu_6.gnp");
		img_axButton = createImage("/img/newui/anniu_6ax.gnp");
		img_selectBround = createImage("/img/newui/xuanzekuang_2.gnp");

		m_rolelis_Frame = new DWFrame(DWGameManager.Screen_Width,
				DWGameManager.Screen_Height);

		m_rolelis_backgroundImg = new DWBackground(img_bigBackground,
				DWGameManager.Screen_Width, DWGameManager.Screen_Height);
		m_rolelis_backgroundImg.setNearAnchor(m_login_Frame,
				Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
		m_rolelis_Frame.addControl(m_rolelis_backgroundImg);

		m_rolelis_background = new DWBackground(
				DWGameManager.Screen_Width - 150 * DWGameManager.Screen_Width / 800
						+ (DWGameManager.Screen_Width == 800 ? 60 : 0),
				DWGameManager.Screen_Height - 150 * DWGameManager.Screen_Height / 480);
		m_rolelis_background.setNearAnchor(m_rolelis_Frame,
				Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER);
		m_rolelis_Frame.addControl(m_rolelis_background);

		m_rolelis_title = new DWTitle("角色选择", m_rolelis_Frame);
		m_rolelis_title.setBackground(
				UIWindows.createImage("/img/newui/jueseliebiao_1.gnp"), false);
		m_rolelis_title.setShowWideHigh(
				m_rolelis_background.getShowWidth() + 16, 35);
		m_rolelis_title.setNearAnchor(m_rolelis_background,
				Tools.HCENTER_BOTTOM, Tools.HCENTER_TOP, 0, 5);
		m_rolelis_Frame.addControl(m_rolelis_title);

		m_rolelis_backbutton = new DWButton("返回登陆", img_back);
		m_rolelis_backbutton.setDownImage(img_back1);
		m_rolelis_backbutton.addListener(new DWListener() {
			public void OnClick()
			{
				m_Auth_state = false;
				if (m_ttListbox != null) {
					m_ttListbox.removeAllSubItem();
				}
				m_role_lock = true;
				addreadserver_flag = false;
				mRoleSelect = 0;

				for (int i = 0; i < mRoleList.length; i++) {
					mRoleList[i] = null;
				}
				DWGameManager.getInstance().closeConnection();
				DWControlsManager.getInstance().removeControl(m_rolelis_Frame);
				m_rolelis_Frame = null;
				//注释
//				if (!ChannelOperation.isChannelSDK) {
					Read_read();
//					m_input_box_1 = m_back_l_ib1;
//					m_input_box_2 = m_back_l_ib2;
//					m_check_box_flag = m_back_status;
//				}
//				else {
//					ChannelOperation.returnLogin();
//				}
			}

			public void OnDoubleClick()
			{
			}
		});

		m_rolelis_backbutton.setNearAnchor(m_rolelis_Frame, Tools.LEFT_BOTTOM,
				Tools.LEFT_BOTTOM, 20, -10);
		m_rolelis_Frame.addControl(m_rolelis_backbutton);

		//显示信息的背景图片
		for (int i = 0; i < ROLE_LIST_SIZE; i++) {
			m_rolelis_msgBackground[i] = new DWBackground(
					(m_rolelis_background.getShowWidth() - 60) / 3, (DWFont.getDefaultFont().getHeight() + 2) * 5 + 20);
			switch (i) {
				case 0:
					m_rolelis_msgBackground[i].setNearAnchor(m_rolelis_background,
							Tools.LEFT_BOTTOM, Tools.LEFT_BOTTOM, 20, -20);
					break;
				case 1:
					m_rolelis_msgBackground[i].setNearAnchor(m_rolelis_background,
							Tools.HCENTER_BOTTOM, Tools.HCENTER_BOTTOM, 0, -20);
					break;
				case 2:
					m_rolelis_msgBackground[i].setNearAnchor(m_rolelis_background,
							Tools.RIGHT_BOTTOM, Tools.RIGHT_BOTTOM, -20, -20);
					break;
			}
			m_rolelis_Frame.addControl(m_rolelis_msgBackground[i]);

			m_rolelis_textbox[i] = new DWTextbox("",
					m_rolelis_msgBackground[i].getShowWidth() - 30, m_rolelis_msgBackground[i].getShowHeight() - 20);
			m_rolelis_textbox[i].setNearAnchor(m_rolelis_msgBackground[i],
					Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER);
			m_rolelis_Frame.addControl(m_rolelis_textbox[i]);
		}

		//选中效果的图片
		m_rolelis_selectBackground = new DWBackground[ROLE_LIST_SIZE];
		for (int i = 0; i < ROLE_LIST_SIZE; i++)
		{
			m_rolelis_selectBackground[i] = new DWBackground(img_selectBround,
					(int) (m_rolelis_msgBackground[i].getShowWidth() * 2 / 3),
					m_rolelis_background.getShowHeight() >> 1);

			m_rolelis_selectBackground[i].setNearAnchor(m_rolelis_msgBackground[i], Tools.HCENTER_BOTTOM,
					Tools.HCENTER_TOP, 0, 10);

			m_rolelis_selectBackground[i].setShow(false);
			m_rolelis_Frame.addControl(m_rolelis_selectBackground[i]);
		}

		//用于监听的listbox
		m_rolelis_listbox = new DWButton[ROLE_LIST_SIZE];
		for (int i = 0; i < ROLE_LIST_SIZE; i++)
		{
			m_rolelis_listbox[i] = new DWButton("", m_rolelis_background.getShowWidth() / 3, m_rolelis_background
					.getShowHeight());
			m_rolelis_listbox[i].setNearAnchor(m_rolelis_msgBackground[i], Tools.HCENTER_BOTTOM, Tools.HCENTER_BOTTOM);
			m_rolelis_listbox[i].setShow(false);
			m_rolelis_listbox[i].setTop(true);
			m_rolelis_Frame.addControl(m_rolelis_listbox[i]);
		}

		//显示小人
		for (int i = 0; i < ROLE_LIST_SIZE; i++) {
			m_rolelis_show[i] = new DWImageBox(img_delete_role, 120, 150);
			m_rolelis_show[i].setNearAnchor(m_rolelis_msgBackground[i],
					Tools.HCENTER_BOTTOM, Tools.HCENTER_TOP, 0, -20);
			int pixelX = ((m_rolelis_background.getShowWidth() - 20) / 3 - m_rolelis_show[i]
					.getShowWidth()) / 2;
			int pixelY = (m_rolelis_background.getShowHeight() - m_rolelis_show[i]
					.getShowHeight()) / 2;
			m_rolelis_show[i].setTouchZoomIn(pixelX, pixelY);
			m_rolelis_Frame.addControl(m_rolelis_show[i]);
		}

		DWControlsManager.getInstance().addControl(m_rolelis_Frame);
		if (!addreadserver_flag) {
			m_rolelis_readserver = new DWLabel("正在读取人物信息……");
			m_rolelis_readserver.setNearAnchor(m_rolelis_Frame,
					Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
			m_rolelis_Frame.addControl(m_rolelis_readserver);
			addreadserver_flag = true;
		}
	}

	/**
	 * 人物列表界面
	 */
	private void roleLogic()
	{

		if (DWControlsManager.getInstance().contains(m_rolelis_Frame))
			DWControlsManager.getInstance().removeControl(m_rolelis_Frame);
		if (DWControlsManager.getInstance().contains(m_login_Frame))
			DWControlsManager.getInstance().removeControl(m_login_Frame);

		if (m_role_lock || m_rolelis_Frame == null) {
			initRoleLogic();
		}
		else {
			if (mRoleSelect == 0 && DWGameManager.getInstance().m_role != null
					&& DWGameManager.getInstance().m_role.m_gameId != 0)
			{
				mRoleSelect = 0;
				for (byte i = 0; i < ROLE_LIST_SIZE; i++)
				{
					if (mRoleList[i] != null && mRoleList[i].m_gameId == DWGameManager.getInstance().m_role.m_gameId)
					{
						mRoleSelect = i;
						break;
					}
				}
			}

			DWControlsManager.getInstance().removeControl(m_rolelis_Frame);
			if (addreadserver_flag) {
				m_rolelis_Frame.removeControl(m_rolelis_readserver);
				addreadserver_flag = false;
			}
			int rolenum = 0;
			for (int i = 0; i < ROLE_LIST_SIZE; i++) {
				final int index = i;
				addRoleButton(i);

				if (mRoleList[i] != null) {
//					m_rolelis_Frame.addControl(m_rolelis_show[i]);
					m_rolelis_textbox[i].setText(getRoleMessage(i));
					if (!mRoleList[i].m_delete) {
						rolenum++;
					}
				}

				m_rolelis_listbox[i].addListener(new DWListener() {
					public void OnDoubleClick()
					{
					}

					public void OnClick()
					{
						if (mRoleList[index] == null)
						{
							DWControlsManager.getInstance().removeControl(m_rolelis_Frame);
							setNextStatus(STATUS_CREATE);
						}

						if (mRoleSelect == index)
							return;

						cleanButton();
						setSelect((byte) index);
						addMenuButton(mRoleList[index]); //添加按钮
					}

				});
			}
			writeServerListRoleNum(rolenum);
			DWControlsManager.getInstance().addControl(m_rolelis_Frame);
		}

	}

	private static final byte CREATROLE = 0;
	private static final byte DELELTROLE = 1;
	private static final byte SELCTROLE = 2;
	private DWButton[] m_rolelis_buttonMenu;
	private String[] m_buttonMenu = { "创建角色", "找回角色", "进入游戏", "删除角色" };

	/**
	 * 添加人物功能选项按钮
	 * @param buttonType
	 */
	private void addMenuButton(Role role)
	{
		byte buttonType = -1;

		//判断显示按钮的类型
		if (role == null)
		{
			buttonType = CREATROLE;
		}
		else if (role.m_delete)
		{
			buttonType = DELELTROLE;
		}
		else
		{
			buttonType = SELCTROLE;
		}

		//创建按钮
		if (m_rolelis_buttonMenu == null)
		{
			m_rolelis_buttonMenu = new DWButton[m_buttonMenu.length];
			for (int i = 0; i < m_buttonMenu.length; i++)
			{
				final int index = i;
				m_rolelis_buttonMenu[i] = new DWButton(m_buttonMenu[i], img_button);
				m_rolelis_buttonMenu[i].setDownImage(img_axButton);
				m_rolelis_buttonMenu[i].addListener(new DWListener() {
					public void OnDoubleClick()
					{
					}

					public void OnClick()
					{
						buttonListener(index);
					}
				});
			}
		}

		switch (buttonType) {
			case CREATROLE:
				m_rolelis_buttonMenu[0]
						.setNearAnchor(m_rolelis_Frame, Tools.RIGHT_BOTTOM, Tools.RIGHT_BOTTOM, -20, -10);
				m_rolelis_Frame.addControl(m_rolelis_buttonMenu[0]);
				break;
			case DELELTROLE:
				m_rolelis_buttonMenu[1]
						.setNearAnchor(m_rolelis_Frame, Tools.RIGHT_BOTTOM, Tools.RIGHT_BOTTOM, -20, -10);
				m_rolelis_Frame.addControl(m_rolelis_buttonMenu[1]);
				break;
			case SELCTROLE:
				m_rolelis_buttonMenu[2]
						.setNearAnchor(m_rolelis_Frame, Tools.RIGHT_BOTTOM, Tools.RIGHT_BOTTOM, -20, -10);
				m_rolelis_Frame.addControl(m_rolelis_buttonMenu[2]);
				m_rolelis_buttonMenu[3].setNearAnchor(m_rolelis_buttonMenu[2], Tools.RIGHT_VCENTER, Tools.LEFT_VCENTER,
						-10, 0);
				m_rolelis_Frame.addControl(m_rolelis_buttonMenu[3]);
				break;
		}

	}

	/**
	 * 人物功能选项
	 * @param index
	 */
	private void buttonListener(int index)
	{
		switch (index) {
			case 0://创建角色
				DWControlsManager.getInstance().removeControl(m_rolelis_Frame);
				setNextStatus(STATUS_CREATE);
				break;
			case 1: //"找回角色"
				DWGameManager.getInstance().getSendMessage().sendUserFindRole(mRoleList[mRoleSelect].m_gameId);
				break;
			case 2://"进入游戏"
				m_role_lock = true;
				addreadserver_flag = false;
				m_icon_flag_1 = true;
				m_icon_more_flag_1 = true;
				m_icon_flag_2 = true;
				m_icon_more_flag_2 = true;
				m_rolelis_buttonMenu = null;
				Loading.s_progress = 0;
				DWGameManager.getInstance().getSendMessage().sendUserSelectRole(mRoleList[mRoleSelect].m_gameId);
				break;
			case 3://"删除角色"
				DWGameManager.getInstance().getSendMessage().sendUserDeleteRole(mRoleList[mRoleSelect].m_gameId);
				break;

		}
	}

	/**
	 * 移除按钮
	 */
	private void cleanButton()
	{
		if (m_rolelis_buttonMenu != null)
		{
			for (DWButton button : m_rolelis_buttonMenu) {
				if (button != null)
					m_rolelis_Frame.removeControl(button);
			}
		}
	}

	/**
	 * 显示人物的信息
	 */
	private String getRoleMessage(int id)
	{
		Role mActorRole = mRoleList[id];
		String m_rowSelect_message_str = null;

		if (mActorRole == null) {
			m_rowSelect_message_str = "";
		}
		else {
			m_rowSelect_message_str = "名称：" + mActorRole.m_name + "`等级："
					+ mActorRole.m_lv + "`性别："
					+ Role.ROLE_SEX_LIST[mActorRole.m_sex] + "`职业："
					+ Role.ROLE_VOCATION_LIST[mActorRole.m_vocation] + "`离线场景："
					+ mActorRole.m_location;
		}
		Tools.debugPrintln(m_rowSelect_message_str);
		return m_rowSelect_message_str;
	}

	/**
	 * 添加人物按钮
	 *
	 * @param buttonID按钮ID
	 * 0~2
	 */
	private void addRoleButton(final int buttonID)
	{
		final int m_roleselete_flag = buttonID;

		if (mRoleSelect == m_roleselete_flag)
		{
			cleanButton();
			addMenuButton(mRoleList[mRoleSelect]);
			setSelect((byte) m_roleselete_flag); //设置为选中
		}
		///////////////////////////////////////////////
		if (mRoleList[buttonID] != null)
		{
			m_rolelis_Frame.removeControl(m_rolelis_show[buttonID]);

			if (!mRoleList[buttonID].m_delete) {
				m_rolelis_show[buttonID] = new DWAnimationBox(mRoleList[buttonID]);
			}
			else {
				m_rolelis_show[buttonID] = new DWImageBox(img_delete_role, 120, 150);;
			}
//			int pixelX = ((m_rolelis_background.getShowWidth() - 20) / 3 - m_rolelis_show[buttonID]
//					.getShowWidth()) / 2;
//			int pixelY = (m_rolelis_background.getShowHeight() - m_rolelis_show[buttonID]
//					.getShowHeight()) / 2;
//
//			m_rolelis_show[buttonID].setTouchZoomIn(pixelX, pixelY);

			m_rolelis_show[buttonID].setNearAnchor(
					m_rolelis_msgBackground[buttonID], Tools.HCENTER_BOTTOM,
					Tools.HCENTER_TOP, 0, -20);

			m_rolelis_Frame.addControl(m_rolelis_show[buttonID]);
		}

		// 添加监听
//		m_rolelis_show[buttonID].addListener(new DWListener() {
//			public void OnDoubleClick()
//			{
//			}
//
//			public void OnClick()
//			{
//				if (mRoleSelect == m_roleselete_flag)
//					return;
//
//				cleanButton();
//				setSelect((byte) m_roleselete_flag);
//				addMenuButton(mRoleList[buttonID]); //添加按钮
//			}
//		});
		///////////////////////////////////////////////////

	}

	/**
	 * 设置选中
	 */
	private void setSelect(byte select)
	{
		m_rolelis_selectBackground[mRoleSelect].setShow(false);
		mRoleSelect = select;
		m_rolelis_selectBackground[mRoleSelect].setShow(true);
	}

	// /////////////////////////////////////////////////////////
	// //林德泉
	// /////////////////////////////////////////////////////////
	/**
	 * lin dequan 创建角色
	 */
	private DWButton m_cr_bt_ok = null;
	private DWButton m_cr_bt_back = null;
	private DWButton m_bt_lingyin = null;// 灵隐
	private DWButton m_bt_tianji = null;// 天机
	private DWButton m_bt_jianke = null;// 剑客
	private DWButton m_bt_wuze = null;//
	private DWButton m_bt_daoshi = null;//
	private DWButton m_bt_xian = null;//
	private DWButton m_bt_yao = null;//
	private DWButton m_bt_ren = null;//
	private DWButton m_bt_gui = null;//
	private DWButton m_bt_nan = null;//
	private DWButton m_bt_nv = null;//
	private DWButton m_bt_nicheng = null;//
	private DWFrame m_cr_Frame = null;//
	private DWTitle m_cr_title = null;//
	private DWLabel m_cr_lb = null;//
	private DWImageBox m_cr_camp = null;//阵营
	private DWImageBox m_cr_zhiye = null;//职业
	private DWTextbox m_cr_zhongzu = null;//种族
	private DWImageBox m_cr_xingbie = null;//性别
	private DWImageBox m_cr_nicheng = null;//昵称
	private Bitmap m_bm_zhenying = null;
	private Bitmap m_bm_zhiye = null;
	private Bitmap m_bm_xingbie = null;
	private Bitmap m_bm_nicheng = null;
	private DWImageBox m_zhenying = null;
	private DWImageBox m_zhiye = null;
	private DWImageBox m_xingbie = null;
	private Bitmap m_bitmap_zhenyingLing = null;
	private Bitmap m_bitmap_zhenyingTian = null;
	private Bitmap m_bitmap_zhiyeJian = null;
	private Bitmap m_bitmap_zhiyeWu = null;
	private Bitmap m_bitmap_zhiyeDao = null;
	private Bitmap m_bitmap_xingbieNan = null;
	private Bitmap m_bitmap_xingbieNv = null;
	private DWTextbox m_cr_zhiyejieshao = null;//
	private DWTextbox m_cr_jeishaoneirong = null;//

	private DWInputBox m_ib_nicheng = null;//
	private DWImageBox m_image_nicheng = null;
	private Bitmap m_bitmap_nicheng = null;
	private DWBackground m_frame_background = null;//
	private DWBackground m_frame_minbeijing = null;//
	private DWBackground m_title_beijing = null;//
	private Bitmap m_bt_background = null;//
	private Bitmap m_bt_fanhui = null;//
	private Bitmap m_bp_open = null;//
	private Bitmap m_bp_close = null;//
	private Bitmap m_bp_title = null;
	private Role m_cr_role = new Role();
	private DWButton[] m_button = new DWButton[14];
	private Bitmap[] m_bm = new Bitmap[14];
	private byte m_lingyin01 = 0;
	private byte m_lingyin02 = 1;
	private byte m_tianji01 = 2;
	private byte m_tianji02 = 3;
	private byte m_jianke01 = 4;
	private byte m_jianke02 = 5;
	private byte m_wuzhe01 = 6;
	private byte m_wuzhe02 = 7;
	private byte m_daoshi01 = 8;
	private byte m_daoshi02 = 9;
	private byte m_nan01 = 10;
	private byte m_nan02 = 11;
	private byte m_nv01 = 12;
	private byte m_nv02 = 13;
	private DWImageBox m_imageBox_touxiang = null;
	private Bitmap[] m_bm_touxiang = new Bitmap[6];
	private byte nanjianke = 0;
	private byte nandaoke = 1;
	private byte nanfashi = 2;
	private byte nvjianke = 3;
	private byte nvdaoke = 4;
	private byte nvfashi = 5;
	private DWBackground m_background_touxiang = null;
	private DWBackground m_background_donghua = null;
	private DWBackground m_background_miaoshu = null;
	private Bitmap m_bm_background = null;
	private Bitmap m_bm_zhiyeBackground = null;
	public static byte ROLE_SEX = 1;//
	public static byte ROLE_RACE = 1;
	public static byte ROLE_VOCATION = 1;// 职业
	public static byte ROLE_CAMP = 1; // 阵营
	private int a1 = 0;// 性别
	private int a2 = 0;// 职业
	private int a3 = 0;// 阵营
	private String VOCATION_JIANKE = "智勇双全，进退自如，拥有高暴击、可以交替使用剑术或者法术伤害对手";
	private String VOCATION_WUZHE = "攻守兼备，擅长防护，特别精通物理伤害，对法术防御比较薄弱";
	private String VOCATION_DAOSHI = "远程法术攻击职业，有多种群体伤害和负面状态的法术，只是物理防御欠佳";

	private DWControl[] m_cr_show = new DWControl[1];
	private Bitmap m_role_dh = null;

	private DWAnimationBox m_cr_abox = null;
	private Actor m_cr_actor = null;
	private String animation = null;

	private DWImageBox m_button_suiji = null;
	private Bitmap m_bm_suiji = null;
	private Bitmap m_bm_suiji01 = null;

	// private String[] m_cr_str = new String[4];
	//选中黄色亮框
	private static final int M_NUM = 7;
	private DWImageBox[] m_juese_liang = new DWImageBox[M_NUM];//铺一层imageBox 用来显示黄框
	private Bitmap m_jiese_kuang = null;

	private void createPeople()
	{

		m_bt_background = createImage("/img/newui/denglubjt_1.gnp");
		m_bt_fanhui = createImage("/img/newui/chuangjianjuese_3.gnp");
		m_bp_open = createImage("/img/newui/anniu_6.gnp");
		m_bm_background = createImage("/img/newui/xzrenwukuang_1.gnp");//动画的背景
		m_bm_zhiyeBackground = createImage("/img/newui/xzjieshuokuang_1.gnp");//描述的背景
		m_bp_title = createImage("/img/newui/denglubtk_1.gnp");
		m_bm_zhenying = createImage("/img/newui/dengluzy_1.gnp");
		m_bm_zhiye = createImage("/img/newui/dengluzhye_1.gnp");
		m_bm_xingbie = createImage("/img/newui/dengluxb_1.gnp");
		m_bm_nicheng = createImage("/img/newui/denglunc_1.gnp");

		// 角色选择按钮
		m_bm[m_lingyin01] = createImage("/img/newui/lingyin_3.gnp");
		m_bm[m_lingyin02] = createImage("/img/newui/lingyin_2.gnp");
		m_bm[m_tianji01] = createImage("/img/newui/tianji_3.gnp");
		m_bm[m_tianji02] = createImage("/img/newui/tianji_4.gnp");
		m_bm[m_jianke01] = createImage("/img/newui/jianke_1.gnp");
		m_bm[m_jianke02] = createImage("/img/newui/jianke_2.gnp");
		m_bm[m_wuzhe01] = createImage("/img/newui/wuzhe_1.gnp");
		m_bm[m_wuzhe02] = createImage("/img/newui/wuzhe_2.gnp");
		m_bm[m_daoshi01] = createImage("/img/newui/daoshi_1.gnp");
		m_bm[m_daoshi02] = createImage("/img/newui/daoshi_2.gnp");
		m_bm[m_nan01] = createImage("/img/newui/anniunan_1.gnp");
		m_bm[m_nan02] = createImage("/img/newui/anniunan_2.gnp");
		m_bm[m_nv01] = createImage("/img/newui/anniunv_1.gnp");
		m_bm[m_nv02] = createImage("/img/newui/anniunv_2.gnp");
		m_bm_suiji = createImage("/img/newui/suijinicheng_1.gnp");
		m_bm_suiji01 = createImage("/img/newui/anniu_2ax.gnp");
		// 角色头像
		m_bm_touxiang[nanjianke] = createImage("/img/newui/banshenxiang_nanjianke.gnp");
		m_bm_touxiang[nandaoke] = createImage("/img/newui/banshenxiang_nandaoke.gnp");
		m_bm_touxiang[nanfashi] = createImage("/img/newui/banshenxiang_nanfashi.gnp");
		m_bm_touxiang[nvjianke] = createImage("/img/newui/banshenxiang_nvjianke.gnp");
		m_bm_touxiang[nvdaoke] = createImage("/img/newui/banshenxiang_nvdaoke.gnp");
		m_bm_touxiang[nvfashi] = createImage("/img/newui/banshenxiang_nvfashi.gnp");
		//职业图片
		m_bitmap_zhenyingLing = createImage("/img/newui/lingyin_4.gnp");
		m_bitmap_zhenyingTian = createImage("/img/newui/tianji_5.gnp");
		m_bitmap_zhiyeJian = createImage("/img/newui/jianke_3.gnp");
		m_bitmap_zhiyeWu = createImage("/img/newui/wuzhe_3.gnp");
		m_bitmap_zhiyeDao = createImage("/img/newui/daoshi_3.gnp");
		m_bitmap_xingbieNan = createImage("/img/newui/nan_2.gnp");
		m_bitmap_xingbieNv = createImage("/img/newui/nv_2.gnp");

		m_bitmap_nicheng = createImage("/img/newui/xzmingzikuang_1.gnp");
		//选择框（黄色）
		m_jiese_kuang = createImage("/img/newui/juesexuenze_1.gnp");

		m_cr_Frame = new DWFrame(DWGameManager.Screen_Width,
				DWGameManager.Screen_Height);
		m_frame_background = new DWBackground(m_bt_background,
				DWGameManager.Screen_Width, DWGameManager.Screen_Height);
		m_frame_background.setNearAnchor(m_cr_Frame, Tools.LEFT_TOP,
				Tools.LEFT_TOP, 0, 0);
		m_cr_Frame.addControl(m_frame_background);

		// m_frame_minbeijing = new DWBackground(
		// DWGameManager.Screen_Width - 150, DWGameManager.Screen_Height - 100);
		// m_frame_minbeijing.setNearAnchor(m_cr_Frame, Tools.HCENTER_VCENTER,
		// Tools.HCENTER_VCENTER);
		// m_cr_Frame.addControl(m_frame_minbeijing);
		// //
		// m_cr_lb = new DWLabel("创建角色");
		// m_cr_lb.setTextColor(Tools.YELLOW);
		//
		// m_title_beijing = new DWBackground(m_bp_title, m_frame_minbeijing
		// .getShowWidth(), m_cr_lb.getShowHeight() + 10);
		// m_title_beijing.setNearAnchor(m_frame_minbeijing, Tools.LEFT_TOP,
		// Tools.LEFT_TOP, 0, 10);
		// m_cr_Frame.addControl(m_title_beijing);
		//
		// m_cr_lb.setNearAnchor(m_title_beijing, Tools.HCENTER_VCENTER,
		// Tools.HCENTER_VCENTER);
		// m_cr_Frame.addControl(m_cr_lb);

		// 设置主屏的接受与返回
		m_cr_bt_ok = new DWButton("返回", m_bp_open);
		m_cr_bt_ok.addListener(m_cr_back);
		m_cr_bt_ok.setNearAnchor(m_cr_Frame, Tools.LEFT_BOTTOM,
				Tools.LEFT_BOTTOM, 20, -10);

		m_cr_camp = new DWImageBox(m_bm_zhenying);
		m_cr_camp.setNearAnchor(m_cr_Frame, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, DWGameManager.Screen_Height / 16 - 20);//12.05

		m_cr_zhiye = new DWImageBox(m_bm_zhiye);
		m_cr_zhiye.setNearAnchor(m_cr_camp, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, DWGameManager.Screen_Height * 5 / 48);

		m_cr_xingbie = new DWImageBox(m_bm_xingbie);
		m_cr_xingbie.setNearAnchor(m_cr_zhiye, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, DWGameManager.Screen_Height * 5 / 48);

		m_cr_nicheng = new DWImageBox(m_bm_nicheng);
		m_cr_nicheng.setNearAnchor(m_cr_xingbie, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, DWGameManager.Screen_Height * 5 / 48);

		// 选择按钮
		m_bt_lingyin = new DWButton("", m_bm[m_lingyin01]);
		m_bt_lingyin.addListener(m_al_lingyin);
		m_bt_lingyin.setNearAnchor(m_cr_camp, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, DWGameManager.Screen_Width * 13 / 80 - 15, 0);//12.05
		m_bt_tianji = new DWButton("", m_bm[m_tianji01]);
		m_bt_tianji.addListener(m_al_tianji);
		m_bt_tianji.setNearAnchor(m_bt_lingyin, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, DWGameManager.Screen_Width * 3 / 20, 0);

		m_bt_jianke = new DWButton("", m_bm[m_jianke01]);
		m_bt_jianke.addListener(m_al_jianke);
		m_bt_jianke.setNearAnchor(m_cr_zhiye, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, DWGameManager.Screen_Width / 8 - 15, 0);//12.05
		m_bt_wuze = new DWButton("", m_bm[m_wuzhe01]);
		m_bt_wuze.addListener(m_al_wuze);
		m_bt_wuze.setNearAnchor(m_bt_jianke, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, DWGameManager.Screen_Width / 8, 0);
		m_bt_daoshi = new DWButton("", m_bm[m_daoshi01]);
		m_bt_daoshi.addListener(m_al_daoshi);
		m_bt_daoshi.setNearAnchor(m_bt_wuze, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, DWGameManager.Screen_Width / 8, 0);

		m_bt_nan = new DWButton("", m_bm[m_nan01]);
		m_bt_nan.addListener(m_al_nan);
		m_bt_nan.setNearAnchor(m_cr_xingbie, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, DWGameManager.Screen_Width * 13 / 80 - 15, 0);//12.05
		m_bt_nv = new DWButton("", m_bm[m_nv01]);
		m_bt_nv.addListener(m_al_nv);
		m_bt_nv.setNearAnchor(m_bt_nan, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, DWGameManager.Screen_Width * 3 / 20, 0);

		// 昵称输入框
		m_ib_nicheng = new DWInputBox(200, m_cr_nicheng.getShowHeight(),
				m_cr_Frame);
		m_ib_nicheng.setTouchZoomIn(0, 20);
		m_ib_nicheng.setNearAnchor(m_cr_nicheng, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, DWGameManager.Screen_Width * 3 / 16, 0);

		m_image_nicheng = new DWImageBox(m_bitmap_nicheng);
		m_image_nicheng.setShow(false);
		m_image_nicheng.setShowWideHigh(m_ib_nicheng.getShowWidth() + 40, m_ib_nicheng.getShowHeight() + 20);
		m_image_nicheng.setTouch(false);
		m_image_nicheng.setNearAnchor(m_ib_nicheng, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
		m_cr_Frame.addControl(m_image_nicheng);
		// 创建角色按钮
		m_bt_nicheng = new DWButton("", m_bt_fanhui);
		m_bt_nicheng.addListener(m_cr_chuanjian);
		m_bt_nicheng.setNearAnchor(m_cr_Frame, Tools.RIGHT_BOTTOM,
				Tools.RIGHT_BOTTOM, -10, -10);

		a1 = (int) Tools.random(1, 2);// 性别
		a2 = (int) Tools.random(1, 3);// 职业
		a3 = (int) Tools.random(1, 2);// 阵营

		// 显示选择
		m_cr_zhiyejieshao = new DWTextbox("职业介绍：");
		if (DWGameManager.AdpaterType == 2) {
			m_cr_zhiyejieshao.setNearAnchor(m_cr_Frame, Tools.HCENTER_TOP,
					Tools.HCENTER_TOP, 400, 30);
		}
		else {
			m_cr_zhiyejieshao.setNearAnchor(m_cr_Frame, Tools.HCENTER_TOP,
					Tools.HCENTER_TOP, 300, 30);
		}
		if (DWGameManager.AdpaterType == 2) {
			m_cr_jeishaoneirong = new DWTextbox("", DWGameManager.Screen_Width * 15 / 80,
					DWGameManager.Screen_Height * 15 / 48);
		}
		else {
			m_cr_jeishaoneirong = new DWTextbox("", 150, 150);
		}

		m_cr_jeishaoneirong.setNearAnchor(m_cr_zhiyejieshao, Tools.LEFT_TOP,
				Tools.LEFT_TOP, 0, DWGameManager.Screen_Height / 16);

		m_background_miaoshu = new DWBackground(m_bm_zhiyeBackground, m_cr_jeishaoneirong.getShowWidth() + 50,
				m_cr_jeishaoneirong.getShowHeight() + 50);
		m_background_miaoshu.setNearAnchor(m_cr_zhiyejieshao, Tools.LEFT_TOP, Tools.LEFT_TOP, -30, 0);
		m_cr_Frame.addControl(m_background_miaoshu);
		// 背景
		// m_background_touxiang = new DWBackground(m_bm_background, 274, 318);
		// m_background_touxiang.setFill(false);
		// m_background_touxiang.setNearAnchor(m_cr_Frame,
		// Tools.HCENTER_VCENTER, Tools.LEFT_VCENTER, 80, 50);

		m_background_donghua = new DWBackground(m_bm_background, 180, 150);
		m_background_donghua.setFill(false);
		m_background_donghua.setNearAnchor(m_cr_Frame, Tools.HCENTER_TOP,
				Tools.HCENTER_TOP, 125, DWGameManager.Screen_Height * 5 / 48);
		m_zhenying = new DWImageBox(m_bitmap_zhenyingLing);
		m_zhenying.setShowWideHigh(69, 33);
		m_zhenying.setNearAnchor(m_background_donghua, Tools.LEFT_BOTTOM, Tools.LEFT_TOP, 0, 0);

		m_zhiye = new DWImageBox(m_bitmap_xingbieNv);
		m_zhiye.setShowWideHigh(69, 33);
		m_zhiye.setNearAnchor(m_zhenying, Tools.LEFT_TOP, Tools.RIGHT_TOP, 0, 0);

		m_xingbie = new DWImageBox(m_bitmap_zhiyeJian);
		m_xingbie.setShowWideHigh(35, 31);
		m_xingbie.setNearAnchor(m_zhiye, Tools.LEFT_TOP, Tools.RIGHT_TOP, 0, 0);
		// 动画
		m_cr_abox = new DWAnimationBox();
		m_cr_abox.setNearAnchor(m_background_donghua, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, -30);

		// 角色头像
		m_imageBox_touxiang = new DWImageBox(m_bm_touxiang[nanjianke]);
		m_imageBox_touxiang.setNearAnchor(m_cr_Frame, Tools.HCENTER_VCENTER,
				Tools.LEFT_VCENTER, DWGameManager.Screen_Width * 433 / 1600, 0);
		//创建随即昵称
		m_button_suiji = new DWImageBox(m_bm_suiji);
//		m_button_suiji.setDownImage(m_bm_suiji01);
		m_button_suiji.addListener(m_nicheng);
		m_button_suiji.setNearAnchor(m_ib_nicheng, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 10, 0);

		//添加选择黄框
		for (int i = 0; i < M_NUM; i++) {
			m_juese_liang[i] = new DWImageBox(m_jiese_kuang);
			m_juese_liang[i].setShow(false);
			m_juese_liang[i].setTouch(false);
		}
		m_juese_liang[0].setNearAnchor(m_bt_lingyin, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
		m_juese_liang[1].setNearAnchor(m_bt_tianji, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
		m_juese_liang[2].setNearAnchor(m_bt_jianke, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
		m_juese_liang[3].setNearAnchor(m_bt_wuze, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
		m_juese_liang[4].setNearAnchor(m_bt_daoshi, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
		m_juese_liang[5].setNearAnchor(m_bt_nan, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
		m_juese_liang[6].setNearAnchor(m_bt_nv, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);

		// 赋值
		ROLE_SEX = (byte) a1;
		ROLE_VOCATION = (byte) a2;
		ROLE_CAMP = (byte) a3;

		if (a1 == 1) {
			m_xingbie.setBackground(m_bitmap_xingbieNan, false);
//			m_bt_nan.setBackground(m_bm[m_nan01], false);
			bianKuangShow(3, 5);

		}
		else {
			m_xingbie.setBackground(m_bitmap_xingbieNv, false);
//			m_bt_nv.setBackground(m_bm[m_nv01], false);
			bianKuangShow(3, 6);
		}

		if (a2 == 1) {
			m_zhiye.setBackground(m_bitmap_zhiyeJian, false);
//			m_bt_jianke.setBackground(m_bm[m_jianke01], false);
			m_cr_jeishaoneirong.setText(VOCATION_JIANKE);
			bianKuangShow(2, 2);
		}
		else if (a2 == 2) {
			m_zhiye.setBackground(m_bitmap_zhiyeWu, false);
//			m_bt_wuze.setBackground(m_bm[m_wuzhe01], false);
			m_cr_jeishaoneirong.setText(VOCATION_WUZHE);
			bianKuangShow(2, 3);
		}
		else if (a2 == 3) {
			m_zhiye.setBackground(m_bitmap_zhiyeDao, false);
//			m_bt_daoshi.setBackground(m_bm[m_daoshi01], false);
			m_cr_jeishaoneirong.setText(VOCATION_DAOSHI);
			bianKuangShow(2, 4);
		}

		if (a3 == 1) {
			m_zhenying.setBackground(m_bitmap_zhenyingLing, false);
//			m_bt_lingyin.setBackground(m_bm[m_lingyin01], false);
			bianKuangShow(1, 0);
		}
		else {
			m_zhenying.setBackground(m_bitmap_zhenyingTian, false);
//			m_bt_tianji.setBackground(m_bm[m_tianji01], false);
			bianKuangShow(1, 1);
		}
		touXiang();

		m_cr_Frame.addControl(m_imageBox_touxiang);
		m_cr_Frame.addControl(m_background_touxiang);
		m_cr_Frame.addControl(m_background_donghua);

		m_cr_Frame.addControl(m_cr_title);
		m_cr_Frame.addControl(m_cr_bt_ok);
		m_cr_Frame.addControl(m_cr_camp);
		m_cr_Frame.addControl(m_cr_zhiye);
		m_cr_Frame.addControl(m_cr_zhongzu);
		m_cr_Frame.addControl(m_cr_xingbie);
		m_cr_Frame.addControl(m_cr_nicheng);
		m_cr_Frame.addControl(m_bt_lingyin);
		m_cr_Frame.addControl(m_bt_tianji);
		m_cr_Frame.addControl(m_bt_jianke);
		m_cr_Frame.addControl(m_bt_wuze);
		m_cr_Frame.addControl(m_bt_daoshi);
		m_cr_Frame.addControl(m_bt_nan);
		m_cr_Frame.addControl(m_bt_nv);
		m_cr_Frame.addControl(m_ib_nicheng);//
		m_cr_Frame.addControl(m_bt_nicheng);
		m_cr_Frame.addControl(m_cr_abox);
		m_cr_Frame.addControl(m_cr_zhiyejieshao);
		m_cr_Frame.addControl(m_cr_jeishaoneirong);
		m_cr_Frame.addControl(m_zhiye);
		m_cr_Frame.addControl(m_xingbie);
		m_cr_Frame.addControl(m_zhenying);
		m_cr_Frame.addControl(m_button_suiji);
		for (int i = 0; i < M_NUM; i++) {
			m_cr_Frame.addControl(m_juese_liang[i]);
		}

		DWControlsManager.getInstance().addControl(m_cr_Frame);

	}

	/**
	 * 七个黄框 用以显示那个亮
	 * 0.灵隐
	 * 1.天机
	 * 2.剑客
	 * 3.武者
	 * 4.道士
	 * 5.男
	 * 6.女
	 * @param index
	 */
	private void bianKuangShow(int hang, int index)
	{
		if (hang == 1) {
			m_juese_liang[0].setShow(false);
			m_juese_liang[1].setShow(false);
		}
		else if (hang == 2) {
			m_juese_liang[2].setShow(false);
			m_juese_liang[3].setShow(false);
			m_juese_liang[4].setShow(false);
		}
		else {
			m_juese_liang[5].setShow(false);
			m_juese_liang[6].setShow(false);
		}
		m_juese_liang[index].setShow(true);
	}

	private void touXiang()
	{
		//坐骑，下半身，上半身，头，武器，特效1，特效2
		if (ROLE_SEX == 1 && ROLE_VOCATION == 1) {// 剑男
			m_imageBox_touxiang.setBackground(m_bm_touxiang[nanjianke], false);
			String[] m_cr_str = { "",
					"zhu_nan_jianke_2_ku",
					"zhu_nan_jianke_2_yi",
					"zhu_nan_jianke_2_tou",
					"wu_jianke_2",
					"",
					"" };
			initRoleRes(m_cr_role, m_cr_str);
			m_cr_abox.setAnimation(m_cr_role);

		}
		else if (ROLE_SEX == 1 && ROLE_VOCATION == 2) {// 武男
			m_imageBox_touxiang.setBackground(m_bm_touxiang[nandaoke], false);
			String[] m_cr_str = { "",
					"zhu_nan_daoke_2_ku",
					"zhu_nan_daoke_2_yi",
					"zhu_nan_daoke_2_tou",
					"wu_daoke_5",
					"",
					"" };
			initRoleRes(m_cr_role, m_cr_str);
			m_cr_abox.setAnimation(m_cr_role);

		}
		else if (ROLE_SEX == 1 && ROLE_VOCATION == 3) {// 道男
			m_imageBox_touxiang.setBackground(m_bm_touxiang[nanfashi], false);
			String[] m_cr_str = { "",
					"zhu_nan_fashi_2_ku",
					"zhu_nan_fashi_2_yi",
					"zhu_nan_fashi_2_tou",
					"wu_fashi_2",
					"",
					"" };
			initRoleRes(m_cr_role, m_cr_str);
			m_cr_abox.setAnimation(m_cr_role);

		}
		else if (ROLE_SEX == 2 && ROLE_VOCATION == 1) {// 剑女
			m_imageBox_touxiang.setBackground(m_bm_touxiang[nvjianke], false);
			String[] m_cr_str = { "",
					"zhu_nv_jianke_2_ku",
					"zhu_nv_jianke_2_yi",
					"zhu_nv_jianke_2_tou",
					"wu_jianke_3",
					"",
					"" };
			initRoleRes(m_cr_role, m_cr_str);
			m_cr_abox.setAnimation(m_cr_role);

		}
		else if (ROLE_SEX == 2 && ROLE_VOCATION == 2) {// 武女
			m_imageBox_touxiang.setBackground(m_bm_touxiang[nvdaoke], false);
			String[] m_cr_str = { "",
					"zhu_nv_daoke_2_ku",
					"zhu_nv_daoke_2_yi",
					"zhu_nv_daoke_2_tou",
					"wu_daoke_5",
					"",
					"" };
			initRoleRes(m_cr_role, m_cr_str);
			m_cr_abox.setAnimation(m_cr_role);

		}
		else if (ROLE_SEX == 2 && ROLE_VOCATION == 3) {// 道女
			m_imageBox_touxiang.setBackground(m_bm_touxiang[nvfashi], false);
			String[] m_cr_str = { "",
					"zhu_nv_fashi_2_ku",
					"zhu_nv_fashi_2_yi",
					"zhu_nv_fashi_2_tou",
					"wu_fashi_2",
					"",
					"" };
			initRoleRes(m_cr_role, m_cr_str);
			m_cr_abox.setAnimation(m_cr_role);

		}

	}

	/**
	 * 创建角色 305
	 *
	 * @param dis
	 * @throws IOException
	 */
	public void createRole(DataInputStream dis) throws IOException
	{

		byte status = dis.readByte();
		DWGameManager.getInstance().getSendMessage()
				.unlockNetwork(GameMessage.锁_默认);
		if (status == 0) {
			DWGameManager.getInstance().showToast("未知错误！", Toast.LENGTH_LONG);
		}
		else if (status == 1) {
			long id = dis.readLong();// 角色的id
			mRoleList[mRoleSelect] = new Role(mUserResource);
			mRoleList[mRoleSelect].m_gameId = id;
			mRoleList[mRoleSelect].m_name = m_ib_nicheng.getText();

			mRoleList[mRoleSelect].m_sex = (byte) (ROLE_SEX);

			mRoleList[mRoleSelect].m_vocation = ROLE_VOCATION;
			mRoleList[mRoleSelect].m_lv = 1;
			mRoleList[mRoleSelect].m_location = "无";
			Tools.debugPrintln("创建角色 : " + mRoleList[mRoleSelect].m_name);

			int size = dis.readByte();
			String[] urls = new String[size];
			for (int i = 0; i < size; i++) {
				urls[i] = mRoleList[mRoleSelect]
						.getFigureName(i, dis.readUTF());
				Tools.debugPrintln("---url-----" + urls[i]);
			}
			initRoleRes(mRoleList[mRoleSelect], urls);
			DWControlsManager.getInstance().removeControl(m_cr_Frame);
//			roleLogic();
			setNextStatus(STATUS_ROLES);
			//注释
//			ChannelOperation.createRole();
		}
		else if (status == 2) {
			DWGameManager.getInstance().addSystemInfo(
					DWGameManager.SYSTEM_INFO_TYPE_B, "昵称存在非法字符！");
		}
		else if (status == 3) {
			DWGameManager.getInstance().addSystemInfo(
					DWGameManager.SYSTEM_INFO_TYPE_B, "昵称重复！");
		}
	}

	// 返回
	private DWListener m_cr_back = new DWListener() {
		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			DWControlsManager.getInstance().removeControl(m_cr_Frame);
			setNextStatus(STATUS_ROLES);
		}
	};

	private DWListener m_nicheng = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			getGameName();
		}
	};

	// 角色创建
	private DWListener m_cr_chuanjian = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{

			if (m_ib_nicheng.getText() == null
					|| m_ib_nicheng.getText().toString().equals("")) {
				DWGameManager.getInstance().showToast("请输入一个昵称",
						Toast.LENGTH_LONG);
			}
			else {
				if (m_ib_nicheng.getText().toString().length() > 6
						|| m_ib_nicheng.getText().toString().length() < 2) {
					DWGameManager.getInstance().showToast("请输入2到6个字符",
							Toast.LENGTH_LONG);
				}
				else {
					DWGameManager
							.getInstance()
							.getSendMessage()
							.sendUserCreateRole(
									m_ib_nicheng.getText().toString(),
									ROLE_SEX, ROLE_VOCATION, ROLE_CAMP);
					// Tools.debugPrintln(m_ib_nicheng.getText().toString() +
					// "/性别：" + ROLE_SEX + "/职业："
					// + ROLE_VOCATION + "/阵营：" + ROLE_CAMP);
					// DWGameManager.getInstance().showToast(
					// m_ib_nicheng.getText().toString() + "/性别：" + ROLE_SEX +
					// "/职业："
					// + ROLE_VOCATION + "/阵营：" + ROLE_CAMP,
					// Toast.LENGTH_SHORT);
				}
			}
		}
	};

	// 职业监听
	private DWListener m_al_jianke = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			m_cr_jeishaoneirong.setText(VOCATION_JIANKE);
			m_zhiye.setBackground(m_bitmap_zhiyeJian, false);
			ROLE_VOCATION = 1;
//			m_bt_jianke.setBackground(m_bm[m_jianke01], false);
//			m_bt_wuze.setBackground(m_bm[m_wuzhe02], false);
//			m_bt_daoshi.setBackground(m_bm[m_daoshi02], false);
			bianKuangShow(2, 2);
			touXiang();

		}
	};
	private DWListener m_al_wuze = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			m_cr_jeishaoneirong.setText(VOCATION_WUZHE);
			m_zhiye.setBackground(m_bitmap_zhiyeWu, false);
			ROLE_VOCATION = 2;
//			m_bt_jianke.setBackground(m_bm[m_jianke02], false);
//			m_bt_wuze.setBackground(m_bm[m_wuzhe01], false);
//			m_bt_daoshi.setBackground(m_bm[m_daoshi02], false);
			bianKuangShow(2, 3);
			touXiang();
		}
	};
	private DWListener m_al_daoshi = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			m_cr_jeishaoneirong.setText(VOCATION_DAOSHI);
			m_zhiye.setBackground(m_bitmap_zhiyeDao, false);
			ROLE_VOCATION = 3;
//			m_bt_jianke.setBackground(m_bm[m_jianke02], false);
//			m_bt_wuze.setBackground(m_bm[m_wuzhe02], false);
//			m_bt_daoshi.setBackground(m_bm[m_daoshi01], false);
			bianKuangShow(2, 4);
			touXiang();
		}
	};

	// 性别监听
	private DWListener m_al_nan = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			ROLE_SEX = 1;
			m_xingbie.setBackground(m_bitmap_xingbieNan, false);
//			m_bt_nan.setBackground(m_bm[m_nan01], false);
//			m_bt_nv.setBackground(m_bm[m_nv02], false);
			bianKuangShow(3, 5);
			touXiang();

		}
	};
	private DWListener m_al_nv = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			ROLE_SEX = 2;
			m_xingbie.setBackground(m_bitmap_xingbieNv, false);
//			m_bt_nan.setBackground(m_bm[m_nan02], false);
//			m_bt_nv.setBackground(m_bm[m_nv01], false);
			bianKuangShow(3, 6);
			touXiang();
		}
	};
	// 阵营监听
	private DWListener m_al_lingyin = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			ROLE_CAMP = 1;
			m_zhenying.setBackground(m_bitmap_zhenyingLing, false);
//			m_bt_lingyin.setBackground(m_bm[m_lingyin01], false);
//			m_bt_tianji.setBackground(m_bm[m_tianji02], false);
			bianKuangShow(1, 0);

		}
	};
	private DWListener m_al_tianji = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			ROLE_CAMP = 2;
			m_zhenying.setBackground(m_bitmap_zhenyingTian, false);
//			m_bt_lingyin.setBackground(m_bm[m_lingyin02], false);
//			m_bt_tianji.setBackground(m_bm[m_tianji01], false);
			bianKuangShow(1, 1);
		}
	};
	private static final String[] NAME_FAMILY = { "赵", "熊", "席", "滕", "皮", "米",
			"梅", "鲁", "孔", "经", "蒋", "和", "酆", "樊", "柏", "郁", "程", "甄", "井",
			"车", "宁", "景", "印", "卓", "闻", "冉", "边", "柴", "向", "都", "欧", "晁",
			"曾", "查", "万俟", "澹台", "钟离", "寸", "翠", "之", "乌雅", "富察", "税", "泰",
			"求", "旁", "禾", "冒", "悟", "苟", "佼", "旷", "叔", "焉", "肇", "徭", "郯",
			"锁", "磨", "同", "卷", "斯", "户", "寒", "揭", "弥", "塔", "腾", "濯", "驹",
			"鲜", "门", "载", "修", "五", "丘", "让", "零", "励", "原", "竹", "南宫", "后",
			"百里", "壤驷", "鲜于", "公良", "迮", "钱", "纪", "季", "殷", "卞", "贝", "盛",
			"韦", "曹", "房", "沈", "穆", "鲍", "胡", "水", "单", "嵇", "麴", "段", "侯",
			"仇", "詹", "宿", "蔺", "莘", "宰", "扈", "瞿", "古", "耿", "殳", "勾", "毋",
			"后", "司马", "公冶", "宇文", "贰", "狂", "章佳", "范姜", "费莫", "荤", "秘", "羽",
			"崇", "示", "保", "宏", "随", "玄", "遇", "圣", "戏", "资", "蛮", "邗", "钟",
			"蒉", "蚁", "脱", "完", "闭", "少", "祈", "阿", "琦", "潮", "沐", "骑", "粟",
			"盈", "声", "信", "令", "义", "尧", "谌", "粘", "考", "百", "赏", "况", "钦",
			"乐正", "锺离", "段干", "孙", "舒", "麻", "罗", "齐", "明", "林", "昌", "严", "裘",
			"韩", "萧", "史", "凌", "窦", "杭", "邢", "家", "富", "宓", "栾", "束", "白",
			"屠", "党", "郦", "燕", "阎", "易", "满", "沃", "敖", "沙", "荆", "上官", "宗政",
			"长孙", "皇", "辟", "那拉", "碧鲁", "蹇", "靖", "亥", "用", "栋", "是", "系", "功",
			"类", "乘", "偶", "御", "可", "合", "汗", "邛", "机", "瓮", "止", "谬", "丹",
			"才", "字", "析", "素", "闪", "镜", "茂", "貊", "栗", "庆", "漫", "闽", "将",
			"礼", "依", "招", "萨", "妫", "福", "伯", "亢", "鄢", "漆雕", "盖", "开", "李",
			"屈", "强", "毕", "康", "臧", "刁", "马", "华", "缪", "杨", "尹", "唐", "霍",
			"章", "洪", "滑", "封", "巫", "蓬", "暴", "龙", "怀", "蒙", "翟", "雍", "冀",
			"充", "慎", "弘", "利", "融", "乜", "红", "欧阳", "濮阳", "慕容", "侨", "典", "冠",
			"张廖", "称", "绪", "绍", "占", "告", "委", "抄", "庚", "卯", "裔", "前", "夫",
			"智", "仍", "孛", "剑", "盘", "弭", "戢", "蹉", "表", "无", "桥", "赤", "长",
			"始", "似", "英", "虎", "豆", "喜", "犁", "北", "旗", "慈", "犹", "续", "邝",
			"纳", "言", "佴", "缑", "汝", "公西", "逯", "光", "周", "项", "贾", "郝", "伍",
			"计", "锺", "苗", "金", "干", "朱", "姚", "费", "虞", "云", "包", "裴", "芮",
			"乌", "全", "甘", "叶", "蒲", "池", "谭", "却", "僪", "慕", "戈", "匡", "蔚",
			"冷", "养", "游", "夏侯", "淳于", "司徒", "彤", "良", "宾", "讷殷富察", "张简", "诺",
			"愈", "以", "真", "休", "钊", "定", "务", "俟", "延", "由", "仆", "尔", "九",
			"乾", "虢", "铎", "刀", "睢", "赧", "聊", "书", "板", "紫", "僧", "星", "澄",
			"兰", "肥", "帛", "及", "力", "守", "军", "孝", "介", "达", "覃", "泉", "第五",
			"佘", "帅", "法", "巫马", "库", "操", "吴", "祝", "路", "邬", "余", "伏", "徐",
			"凤", "魏", "解", "秦", "邵", "廉", "万", "苏", "诸", "陆", "羿", "焦", "郗",
			"钭", "幸", "邰", "乔", "贡", "璩", "浦", "连", "廖", "国", "越", "訾", "鞠",
			"竺", "诸葛", "单于", "司空", "竭", "函", "香", "图门", "来", "硕", "壬", "穰",
			"褒", "频", "化", "敏", "友", "植", "咎", "镇", "凭", "衷", "帖", "隋", "斛",
			"疏", "冼", "浮", "源", "学", "斐", "青", "隐", "南", "潭", "檀", "鹿", "官",
			"普", "贸", "坚", "行", "理", "承", "忻", "辜", "老", "佟", "牟", "微生", "闫",
			"端木", "郏", "瑞", "王", "梁", "危", "常", "卜", "戴", "骆", "方", "姜", "宗",
			"许", "汪", "薛", "柯", "葛", "石", "翁", "靳", "弓", "仰", "戎", "韶", "鄂",
			"郁", "逄", "桂", "农", "习", "终", "寇", "隆", "阚", "丰", "逮", "东方", "申屠",
			"有", "赫", "苦", "公叔", "繁", "买", "斋", "闾", "锐", "呼", "校", "拱", "乙",
			"矫", "敛", "邸", "进", "刑", "洛", "茆", "线", "浑", "涂", "说", "吾", "本",
			"千", "刚", "隽", "接", "纵", "枝", "野", "衣", "营", "革", "汉", "敬", "卿",
			"所", "鄞", "楼", "德", "年", "西门", "海", "晋", "子车", "阴", "泥", "郑", "董",
			"娄", "安", "元", "成", "邱", "花", "陶", "应", "尤", "湛", "岑", "支", "潘",
			"左", "荣", "储", "巴", "班", "历", "司", "从", "阳", "劳", "桑", "尚", "茹",
			"庾", "文", "夔", "辛", "须", "权", "闻人", "太叔", "召", "端", "芒", "果", "太史",
			"多", "牢", "森", "翦", "谏", "嬴", "莱", "捷", "答", "环", "塞", "藩", "悉",
			"哀", "罕", "蒿", "玉", "牵", "种", "顿", "姓", "愚", "独", "柔", "仙", "天",
			"謇", "藤", "雀", "布", "建", "勤", "勇", "奉", "伦", "市", "六", "初", "清",
			"爱", "商", "羊舌", "楚", "颛孙", "逢", "眭", "陈", "阮", "童", "于", "孟", "宋",
			"夏", "任", "谢", "宣", "吕", "毛", "贺", "管", "范", "吉", "羊", "邴", "隗",
			"仲", "武", "黎", "咸", "能", "申", "牛", "别", "艾", "居", "禄", "巩", "简",
			"关", "益", "皇甫", "仲孙", "甫", "京", "完颜", "朴", "巧", "奕", "贵", "闳", "威",
			"抗", "丑", "甲", "昔", "泷", "掌", "厚", "仵", "洋", "苌", "箕", "势", "己",
			"错", "展", "雪", "嘉", "拜", "祭", "碧", "奈", "生", "飞", "宝", "望", "兴",
			"尉", "仪", "永", "杞", "迟", "区", "过", "谯", "左丘", "呼延", "宰父", "仉", "厉",
			"摩", "冯", "杜", "江", "乐", "顾", "谈", "高", "俞", "戚", "丁", "何", "祁",
			"雷", "昝", "奚", "崔", "荀", "汲", "牧", "秋", "祖", "郜", "索", "胥", "姬",
			"濮", "温", "宦", "暨", "广", "师", "那", "巢", "盍", "赫连", "公孙", "舜", "实",
			"其", "乌孙", "戊", "但", "释", "漆", "皋", "大", "么", "兆", "允", "赛", "受",
			"府", "笃", "俎", "淦", "菅", "针", "恽", "肖", "次", "寻", "性", "诗", "奇",
			"宇", "波", "渠", "检", "禽", "藏", "巨", "改", "练", "恭", "问", "苑", "战",
			"城", "卑", "笪", "东门", "归", "谷梁", "督", "薄", "运", "卫", "闵", "郭", "傅",
			"黄", "庞", "田", "柳", "喻", "邓", "张", "狄", "汤", "莫", "郎", "龚", "惠",
			"松", "谷", "宫", "刘", "溥", "赖", "双", "堵", "通", "晏", "容", "步", "东",
			"聂", "空", "相", "公", "公羊", "令狐", "岳", "象", "夕", "佟佳", "毓", "撒", "朋",
			"贯", "歧", "律", "綦", "畅", "尾", "度", "衅", "员", "业", "夷", "郸", "桐",
			"绳", "仝", "潜", "夙", "不", "烟", "善", "陀", "淡", "禚", "春", "登", "宜",
			"银", "道", "睦", "旅", "堂", "位", "第", "宛", "台", "曲", "墨", "琴", "东郭",
			"拓跋", "亓官", "闾丘", "铁", "褚", "蓝", "颜", "时", "平", "茅", "蔡", "袁", "邹",
			"贲", "施", "禹", "倪", "卢", "彭", "钮", "於", "糜", "山", "伊", "符", "蓟",
			"籍", "苍", "扶", "寿", "庄", "鱼", "衡", "阙", "厍", "饶", "蒯", "桓", "尉迟",
			"轩辕", "丛", "集", "中", "马佳", "回", "枚", "姒", "代", "在", "昂", "祢", "丙",
			"留", "侍", "袭", "首", "仁", "圭", "邶", "树", "庹", "世", "泣", "念", "出",
			"霜", "扬", "佛", "酒", "速", "风", "折", "节", "钞", "希", "亓", "士", "母",
			"辉", "剧", "候", "局", "麦", "哈", "梁丘", "南门", "夹谷", "司寇", "稽", "伟" };
	private static final String[] NAME_BOY = { "晓山", "向山", "绮山", "雁山", "夜山",
			"忆山", "雅山", "夏山", "丹山", "紫山", "恨山", "思山", "觅山", "以山", "沛山", "盼山",
			"若山", "涵山", "怀山", "醉山", "梦山", "之山", "语山", "慕山", "谷山", "白山", "千山",
			"映之", "梦之", "飞之", "如之", "新之", "水之", "妙之", "凡之", "念之", "海之", "夏之",
			"冷之", "傲之", "谷之", "忆之", "初之", "小之", "香之", "乐之", "含之", "恨之", "冰之",
			"靖之", "从南", "丹南", "紫南", "若南", "听南", "谷南", "初南", "忆南", "向南", "书南",
			"幼南", "如南", "傲南", "安南", "以南", "雨南", "笑南", "绮南", "寄南", "寻南", "怜南",
			"迎南", "夜南", "采南", "涵易", "醉易", "书易", "梦易", "映易", "白易", "友易", "青易",
			"曼易", "千易", "冬易", "又易", "靖易", "盼易", "雁易", "紫易", "傲易", "思枫", "乐枫",
			"幻枫", "听枫", "采枫", "忆枫", "芷枫", "元枫", "静枫", "幼枫", "若枫", "青枫", "冰枫",
			"访枫", "雪枫", "问枫", "白枫", "灵枫", "雁枫", "谷枫", "春枫", "夜云", "以云", "寒云",
			"含云", "念云", "亦云", "巧云", "从云", "恨云", "若云", "怜云", "诗云", "访云", "水云",
			"尔云", "之云", "孤云", "海云", "冬云", "寻云", "芷云", "宛云", "代云", "谷云", "傲云",
			"曼云", "丹云", "寄云", "夏云", "凝云", "依云", "易云", "觅云", "绿云", "听云", "紫云",
			"雅云", "以寒", "映寒", "听寒", "凌寒", "怜寒", "念寒", "紫寒", "青寒", "雨寒", "雅寒",
			"惜寒", "从寒", "曼寒", "恨寒", "秋寒", "亦寒", "灵寒", "忆寒", "夏寒", "安寒", "梦寒",
			"笑寒", "冬寒", "丹寒", "问寒", "怀寒", "语寒", "白曼", "沛白", "书白", "采白", "尔白",
			"白桃", "白安", "白萱", "白夏", "静白", "白梅", "白莲", "安白", "听白", "凡白", "幼白",
			"白梦", "白筠", "海白", "山白", "宛白", "秋白", "白凝", "白柏", "傲白", "碧白", "笑白",
			"白卉", "白凡", "白容", "白风", "白翠", "依白", "夜白", "白竹", "白薇", "白秋", "白亦",
			"白玉", "白晴", "平夏", "夏柳", "迎夏", "夏菡", "小夏", "问夏", "冰夏", "夏岚", "盼夏",
			"初夏", "夏槐", "夏容", "夏真", "觅夏", "夏波", "夏旋", "巧夏", "又夏", "紫夏", "晓夏",
			"绿夏", "夏青", "夏烟", "冰烟", "思烟", "若烟", "访烟", "盼烟", "新烟", "尔烟", "芷烟",
			"灵烟", "丹烟", "半烟", "易烟", "怜烟", "青烟", "南烟", "含烟", "飞烟", "念烟", "依烟",
			"秋烟", "绮烟", "寒烟", "依风", "访风", "水风", "尔风", "寄风", "问风", "雁风", "飞风",
			"觅风", "语风", "初风", "元风", "沛风", "孤风", "巧风", "忆风", "翠风", "千风", "映风",
			"南风", "如风", "恨风", "海风", "书文", "紫文", "寄文", "雨文", "从文", "沛文", "平文",
			"念文", "访文", "青文", "忆文", "采文", "凌文", "寻文", "曼文", "芷文", "易文", "惜文",
			"春文", "新波", "如波", "醉波", "香波", "灵波", "安波", "幻波", "凡波", "依波", "从波",
			"寄波", "迎波", "采波", "映波", "谷波", "觅波", "芷波", "访波", "念波", "绮波", "凌波",
			"盼波", "凌春", "凌旋", "凌青", "凌柏", "凌珍", "凌晴", "凌翠", "凌丝", "凌双", "凌萱",
			"凌瑶", "凌雪", "凌蝶", "凌香", "凝阳", "雅阳", "孤阳", "含阳", "从阳", "初阳", "翠阳",
			"尔阳", "以阳", "安阳", "飞阳", "采阳", "凡阳", "怜阳", "涵阳", "灵阳", "笑阳", "映阳",
			"书阳", "代秋", "灵秋", "映秋", "梦秋", "依秋", "宛秋", "海秋", "盼秋", "千秋", "谷秋",
			"向秋", "忆秋", "丹秋", "海露", "觅海", "凝海", "绿海", "海雪", "沛海", "海安", "海蓝",
			"春海", "惜海", "海瑶", "冷海", "海冬", "海莲", "痴海", "海亦", "盼海", "迎海", "海菡",
			"冰海", "语海", "海凡", "妙海", "宛海", "海桃", "含海", "又亦", "亦巧", "天亦", "青亦",
			"亦丝", "亦玉", "冬亦", "亦竹", "采亦", "代亦", "丹亦", "亦梅", "秋亦", "亦旋", "宛亦",
			"怀亦", "千亦", "以亦", "亦绿", "晓亦", "亦凝", "冷亦", "碧凡", "冰凡", "凡雁", "曼凡",
			"凡双", "梦凡", "凡巧", "凡松", "凡桃", "如凡", "千凡", "雁凡", "小凡", "寒凡", "晓凡",
			"凡儿", "灵凡", "凡灵", "凡梅", "凡梦", "寄凡", "巧凡", "凡旋", "凡霜", "凡柔", "半凡",
			"凡蕾", "平凡", "水凡", "南松", "雅松", "以松", "又松", "绿松", "寒松", "平松", "乐松",
			"如松", "傲松", "迎松", "妙松", "向松", "觅松", "孤松", "冷松", "灵松", "思松", "梦松",
			"恨松", "飞松", "寄松", "恨真", "向真", "尔真", "代真", "雨真", "思真", "映真", "天真",
			"安真", "迎真", "寄真", "念真", "易真", "寻真", "访真", "笑真", "绿真", "紫真", "冰真",
			"平蓝", "代蓝", "又蓝", "紫蓝", "醉蓝", "晓蓝", "芷蓝", "冰蓝", "尔蓝", "水蓝", "初蓝",
			"笑蓝", "以蓝", "天蓝", "寄蓝", "谷蓝", "忆蓝", "沛蓝", "采蓝", "问旋", "青旋", "笑旋",
			"雨旋", "雅旋", "香旋", "幼旋", "又旋", "访旋", "盼旋", "晓旋", "傲旋", "元旋", "痴旋",
			"以旋", "梦旋", "雁旋", "绿旋", "冰旋", "雪旋", "凝旋", "丹旋", "妙旋", "灵薇", "灵竹",
			"从灵", "痴灵", "友灵", "冬灵", "惜灵", "忆灵", "含灵", "灵安", "代灵", "晓灵", "灵槐",
			"灵雁", "寄灵", "若灵", "雨灵", "灵萱", "之灵", "幻灵", "秋灵", "寒灵", "灵冬", "平灵",
			"碧灵", "元灵", "灵珊", "慕灵", "山灵", "沛灵", "安筠", "雨安", "听安", "问安", "安梦",
			"寒安", "乐安", "紫安", "平安", "安露", "傲安", "安柏", "安容", "安卉", "安青", "友安",
			"翠安", "安春", "曼安", "忆安", "从安", "安珊", "安荷", "尔安", "半安", "巧安", "梦安",
			"安双", "冰安", "凝安", "安萱", "冷安", "安雁", "安彤", "映安", "安莲", "安蕾", "夜安",
			"碧菡", "妙菡", "傲菡", "山菡", "涵菡", "从菡", "沛菡", "寻菡", "又菡", "映菡", "梦菡",
			"雁菡", "宛菡", "以菡", "怜菡", "宛筠", "从筠", "听筠", "静筠", "新筠", "问筠", "晓筠",
			"雨筠", "以筠", "惜筠", "冰筠", "忆筠", "青筠", "诗筠", "以冬", "醉冬", "凝冬", "曼冬",
			"春冬", "冬梅", "冬菱", "尔冬", "元冬", "访冬", "映冬", "冬儿", "新冬", "冬莲", "寻冬",
			"水冬", "谷冬", "冬卉", "冬雁", "如冬", "冬萱", "傲冬", "从冬", "忆梅", "忆雪", "忆柳",
			"忆彤", "忆青", "忆香", "忆柏", "忆丹", "忆曼", "忆莲", "忆翠", "忆霜", "醉薇", "醉柳",
			"醉巧", "醉香", "醉芙", "醉蝶", "醉卉", "醉竹", "冰菱", "冰岚", "千青", "千琴", "千凝",
			"千雁", "千柳", "飞柏", "静柏", "梦柏", "念柏", "涵柏", "青柏", "雅柏", "幻柏", "妙柏",
			"傲柏", "如柏", "靖柏", "绿柏", "痴柏", "秋柏", "春柏", "翠柏", "幼柏", "香柏", "山柏",
			"元柏", "雨柏", "夜梅", "夜蓉", "夜香", "夜柳", "夜天", "夜玉", "夜卉", "夜春", "夜雪",
			"夜蕾", "夜绿", "夜梦", "向雪", "向彤", "向薇", "向萍", "向雁", "向槐", "向梦", "向露",
			"向珊", "向卉", "碧萱", "碧蓉", "碧琴", "碧春", "碧玉", "碧曼", "碧巧", "碧彤", "易蓉",
			"易巧", "易容", "易梦", "易雁", "易槐", "易绿", "若雁", "若翠", "若薇", "若菱", "若蕊",
			"傲丝", "傲玉", "傲柔", "傲蕊", "傲蕾", "傲珊", "傲芙", "傲儿", "傲薇", "傲晴", "傲霜",
			"寒梦", "怜梦", "梦容", "惜梦", "采梦", "痴梦", "从梦", "梦竹", "梦槐", "映梦", "梦香",
			"梦蕊", "语梦", "梦桃", "半梦", "梦岚", "念梦", "梦菲", "梦玉", "梦露", "凝梦", "怀梦",
			"迎梦", "访梦", "青梦", "梦曼", "谷梦", "妙梦", "梦萱" };
	private static final String[] NAME_GIRL = { "梦萱", "依珊", "秋珊", "静珊", "笑珊",
			"幼珊", "寒珊", "元珊", "代珊", "友珊", "芷珊", "诗珊", "惜珊", "怜珊", "安珊", "以珊",
			"从珊", "傲珊", "沛珊", "采珊", "幻珊", "雪珊", "向珊", "痴珊", "灵珊", "书蕾", "怜蕾",
			"新蕾", "含蕾", "念蕾", "寄蕾", "傲蕾", "寒蕾", "怀蕾", "半蕾", "诗蕾", "涵蕾", "芷蕾",
			"晓蕾", "春蕾", "南蕾", "从蕾", "夜蕾", "凡蕾", "安蕾", "迎蕾", "小蕾", "南琴", "友琴",
			"丹琴", "绮琴", "碧琴", "依琴", "雅琴", "访琴", "翠琴", "寄琴", "凝琴", "千琴", "语琴",
			"雨琴", "又琴", "书琴", "尔琴", "寻琴", "书兰", "盼兰", "绿兰", "涵兰", "初兰", "凌兰",
			"问兰", "雁兰", "飞兰", "山兰", "夏兰", "诗兰", "含兰", "雨兰", "谷兰", "半兰", "冰兰",
			"晓兰", "绮兰", "语兰", "雪兰", "千兰", "听兰", "孤兰", "巧兰", "千青", "雅青", "平青",
			"诗青", "慕青", "凌青", "巧青", "半青", "曼青", "忆青", "安青", "又青", "天青", "雪青",
			"紫青", "雨青", "夏青", "碧蓉", "从蓉", "雁蓉", "尔蓉", "易蓉", "语蓉", "迎蓉", "乐蓉",
			"绿蓉", "夜蓉", "如蓉", "幻蓉", "听蓉", "夏蓉", "幼蓉", "水蓉", "南蓉", "寄蓉", "天蓉",
			"凝芙", "山芙", "尔芙", "雁芙", "翠芙", "语芙", "盼芙", "静芙", "傲芙", "醉芙", "问芙",
			"代芙", "含芙", "妙芙", "芷蝶", "绿蝶", "山蝶", "丹蝶", "冰蝶", "秋蝶", "语蝶", "凝蝶",
			"初蝶", "尔蝶", "元蝶", "凌蝶", "怀蝶", "香蝶", "恨蝶", "平蝶", "醉蝶", "孤蝶", "书蝶",
			"又儿", "沛儿", "乐儿", "问儿", "慕儿", "访儿", "友儿", "靖儿", "千儿", "新儿", "凡儿",
			"冬儿", "语儿", "春儿", "傲儿", "宛儿", "觅儿", "惜儿", "盼儿", "水儿", "幻儿", "以儿",
			"如彤", "妙彤", "元彤", "忆彤", "曼彤", "向彤", "山彤", "冰彤", "雅彤", "以彤", "夏彤",
			"访彤", "绮彤", "水彤", "从彤", "翠彤", "平彤", "香彤", "迎彤", "安彤", "丹彤", "碧彤",
			"初彤", "雅柔", "新柔", "觅柔", "依柔", "靖柔", "寄柔", "春柔", "千柔", "怀柔", "语柔",
			"傲柔", "秋柔", "沛柔", "又柔", "曼柔", "代柔", "初柔", "思柔", "翠柔", "之柔", "凡柔",
			"以蕊", "灵蕊", "谷蕊", "梦蕊", "水蕊", "凝蕊", "怀蕊", "傲蕊", "诗蕊", "访蕊", "小蕊",
			"芷蕊", "友蕊", "绿蕊", "慕蕊", "恨蕊", "乐蕊", "雅蕊", "若蕊", "问蕊", "惜蕊", "含蕊",
			"巧蕊", "语蕊", "香寒", "香薇", "香萱", "雅香", "香波", "香菱", "香莲", "香卉", "曼香",
			"梦香", "香旋", "寒香", "香巧", "香岚", "盼香", "忆香", "香春", "问香", "香天", "又香",
			"元香", "痴香", "夜香", "香桃", "香露", "香柳", "醉香", "凌香", "香梅", "冰香", "香之",
			"香柏", "青香", "巧香", "幻香", "半香", "惜香", "香凝", "水香", "香芹", "凌春", "绿春",
			"碧春", "春竹", "春海", "巧春", "春雁", "采春", "春冬", "寻春", "天春", "听春", "秋春",
			"安春", "春翠", "妙春", "春梅", "平春", "春绿", "春柏", "寄春", "南春", "夜春", "沛春",
			"问春", "痴春", "春文", "之瑶", "亦瑶", "初瑶", "元瑶", "晓瑶", "夏瑶", "雪瑶", "恨瑶",
			"寄瑶", "痴瑶", "书瑶", "海瑶", "新瑶", "友瑶", "乐瑶", "凌瑶", "涵瑶", "飞瑶", "念瑶",
			"水瑶", "依瑶", "采萱", "碧萱", "雅萱", "依萱", "白萱", "丹萱", "映萱", "惜萱", "乐萱",
			"小萱", "思萱", "凌萱", "紫萱", "平萱", "如萱", "幼萱", "灵萱", "安萱", "冷萱", "翠萱",
			"代萱", "书萱", "冬萱", "梦萱", "天荷", "曼荷", "凝荷", "代荷", "寒荷", "冷荷", "飞荷",
			"采荷", "巧荷", "幼荷", "乐荷", "秋荷", "芷荷", "觅荷", "恨荷", "听荷", "迎荷", "安荷",
			"雁荷", "靖荷", "水荷", "翠荷", "雨荷", "听芹", "半芹", "书芹", "沛芹", "惜芹", "代芹",
			"谷芹", "念芹", "怀芹", "冰芹", "元芹", "寻芹", "语芹", "秋双", "秋柳", "秋巧", "秋莲",
			"秋白", "秋寒", "秋灵", "秋翠", "幼霜", "念霜", "从霜", "笑霜", "翠霜", "如霜", "惜霜",
			"小霜", "涵霜", "依霜", "凡霜", "诗霜", "傲霜", "冷霜", "雅霜", "南霜", "忆霜", "晓霜",
			"紫霜", "灵薇", "醉薇", "依薇", "之薇", "念薇", "向薇", "冰薇", "怀薇", "若薇", "天薇",
			"问薇", "傲薇", "语薇", "飞薇", "白薇", "白曼", "曼凡", "曼雁", "又曼", "巧曼", "乐曼",
			"访曼", "曼菱", "青曼", "曼梅", "迎曼", "曼冬", "曼易", "晓曼", "曼卉", "雪曼", "碧曼",
			"曼安", "如曼", "怀曼", "曼岚", "静曼", "盼曼", "尔曼", "曼寒", "曼容", "忆曼", "惜曼",
			"初曼", "曼云", "曼文", "代曼", "曼珍", "梦曼", "曼凝", "水曼", "翠曼", "天曼", "绿海",
			"绿竹", "凝绿", "采绿", "平绿", "友绿", "静绿", "雅绿", "元绿", "绿松", "翠绿", "晓绿",
			"寻绿", "冰绿", "绿柳", "又绿", "幼绿", "南绿", "绿柏", "绿旋", "怀绿", "亦绿", "易绿",
			"雪绿", "寒绿", "绿云", "绿真", "绿夏", "夜绿", "绿凝", "水绿", "飞绿", "巧绿", "夏柳",
			"语柳", "忆柳", "涵柳", "盼柳", "雪柳", "醉柳", "元柳", "之柳", "问柳", "尔柳", "山柳",
			"夜柳", "以柳", "采柳", "初柳", "笑柳", "诗柳", "千柳", "靖巧", "雪巧", "亦巧", "晓巧",
			"念巧", "巧云", "凡巧", "易巧", "醉巧", "冰巧", "翠巧", "碧巧", "寻巧", "巧风", "幻巧",
			"巧安", "盼巧", "含巧", "巧凡", "巧夏", "笑巧", "天巧", "代巧", "芷巧", "新巧", "乐巧",
			"灵竹", "妙竹", "梦竹", "亦竹", "尔竹", "恨竹", "新竹", "水竹", "幻竹", "凝竹", "雨竹",
			"书竹", "静竹", "白竹", "醉竹", "水卉", "友卉", "雪卉", "代卉", "之卉", "雁卉", "笑卉",
			"冷卉", "芷卉", "安卉", "访卉", "平卉", "思卉", "白卉", "夜卉", "冬卉", "向卉", "含卉",
			"慕卉", "醉卉", "冰露", "幻露", "雁露", "从露", "安露", "晓露", "听露", "梦露", "向露",
			"初露", "平露", "绮露", "南露", "念露", "觅露", "凝阳", "凝海", "从凝", "小凝", "凝雁",
			"凝冬", "凝莲", "雨凝", "依凝", "痴凝", "凝天", "宛凝", "寻凝", "凝丝", "白凝", "沛凝",
			"千凝", "凝梦", "书凝", "凝旋", "凝云", "凝安", "问凝", "凝丹", "亦凝", "凝珍", "慕凝",
			"寒凝", "乐珍", "冰珍", "尔珍", "凌珍", "觅珍", "初珍", "飞珍", "丹珍", "雪珍", "小珍",
			"念珍", "靖珍", "雨珍", "冷珍", "南珍", "芷珍", "怀桃", "白桃", "含桃", "之桃", "友桃",
			"恨桃", "梦桃", "凡桃", "翠桃", "书桃", "水桃", "代桃", "幻桃", "寻桃", "雁桃", "念桃",
			"诗桃", "海桃", "涵桃", "盼晴", "又晴", "笑晴", "以晴", "孤晴", "雪晴", "绮晴", "凌晴",
			"怜晴", "山晴", "幼晴", "妙晴", "天晴", "新晴", "傲晴", "觅晴", "尔晴", "初晴", "南晴",
			"白晴", "慕晴", "冰夏", "冰双", "冰筠", "冰蓝", "冰萍", "笑萍", "向萍", "孤萍", "问萍",
			"紫萍", "雪萍", "惜萍", "怀萍", "沛萍", "小萍", "千萍", "向真", "向山", "向雪", "向南",
			"向雁", "向槐", "向梦", "向松", "向秋", "碧凡", "碧菡", "碧玉", "碧白", "碧灵", "从灵",
			"痴灵", "友灵", "冬灵", "惜灵", "忆灵", "含灵", "代灵", "晓灵", "寄灵", "若灵", "雨灵",
			"凡灵", "之灵", "幻灵", "寒灵", "平灵", "元灵", "慕灵", "山灵", "沛灵", "初翠", "初南",
			"初丹", "初风", "初阳", "初夏", "初蓝", "初雪", "初之", "怜雪", "怜梦", "怜翠", "怜寒",
			"怜云", "怜双", "怜烟", "怜容", "怜阳", "怜南", "怜菡", "语雪", "语玉", "语风", "语梦",
			"语海", "语丝", "语山", "语寒" };
	private String familyName = null;
	private String boyName = null;
	private String girlName = null;
	private static String nicheng = null;

	//自动获得昵称
	private void getGameName()
	{
		int family = Tools.random(0, NAME_FAMILY.length - 1);
		if (ROLE_SEX == 1) {//男
			int boy = Tools.random(0, NAME_BOY.length - 1);
			nicheng = NAME_FAMILY[family] + NAME_BOY[boy];
		}
		else {//女
			int girl = Tools.random(0, NAME_GIRL.length - 1);
			nicheng = NAME_FAMILY[family] + NAME_GIRL[girl];
		}
		m_ib_nicheng.setText(nicheng);
	}

	// //////////////////////////////////////////
	// 穆建辰
	// //////////////////////////////////////////

	/**
	 * 服务器列表界面
	 */
	private DWFrame m_fwqFrame = null;
	private DWTitle m_fwqTitle = null;
	private DWTextbox m_fwqTextbox01 = null;
	private DWTextbox m_fwqTextbox02 = null;
	private DWTextbox m_fwqTextbox03 = null;
	private DWTextbox m_fwqTextbox04 = null;
	private DWTextbox m_fwqTextbox05 = null;
	private DWTextbox m_fwqTextbox06 = null;
	private DWTextbox m_fwqTextbox07 = null;
	private Bitmap m_fwqBitmap01 = null;
	private Bitmap m_fwqBitmap02 = null;
	private Bitmap m_fwqBitmap03 = null;
	private Bitmap m_fwqBitmap04 = null;
	private Bitmap m_fwqBitmap06 = null;

	private Bitmap m_fwqBitmap02_a = null;
	private Bitmap m_fwqBitmap02_ax = null;

	private Bitmap m_fwqBitmap_BJ = null;

	private DWBackground m_fwqBackground01 = null;
	private DWBackground m_fwqBackground02 = null;
	private DWBackground m_fwqBackground03 = null;
	private DWButton m_fwqButton01 = null;
	private DWImageBox m_fwqImageBox01 = null;

	private DWTextbox m_fwqTextbox_TS = null;

	private DWListbox m_ttListbox = null;

	private void fuwuqi()
	{
		m_fwqBitmap01 = UIWindows.createImage("/img/newui/denglubjt_1.gnp");
		m_fwqBitmap02 = UIWindows.createImage("/img/newui/anniu_6.gnp");
		m_fwqBitmap03 = UIWindows.createImage("/img/newui/fuwuqiliebiao_1.gnp");
		m_fwqBitmap04 = UIWindows.createImage("/img/newui/anniu_6ax.gnp");

		m_fwqBitmap02_a = UIWindows.createImage("/img/newui/anniu_14.gnp");
		m_fwqBitmap02_ax = UIWindows.createImage("/img/newui/anniu_14ax.gnp");

		m_fwqBitmap_BJ = UIWindows.createImage("/img/newui/liaotiandsrks1.gnp");

		m_fwqFrame = new DWFrame(DWGameManager.Screen_Width,
				DWGameManager.Screen_Height);

		m_fwqBackground01 = new DWBackground(m_fwqFrame.getShowWidth() - 200,
				m_fwqFrame.getShowHeight() - 150);
		m_fwqBackground01.setNearAnchor(m_fwqFrame, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER);

		m_fwqBackground02 = new DWBackground(m_fwqBitmap01, 0, 0,
				m_fwqFrame.getShowWidth(), m_fwqFrame.getShowHeight());
		m_fwqBackground02.setNearAnchor(m_fwqFrame, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER);

		m_fwqTitle = new DWTitle(null, m_fwqFrame);
		m_fwqTitle.setNearAnchor(m_fwqBackground01, Tools.LEFT_BOTTOM,
				Tools.LEFT_TOP);
		m_fwqTitle.setShowWideHigh(m_fwqBackground01.getShowWidth(), m_fwqTitle.getShowHeight());

		m_fwqImageBox01 = new DWImageBox(m_fwqBitmap03);
		m_fwqImageBox01.setNearAnchor(m_fwqTitle, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER);

		m_fwqTextbox_TS = new DWTextbox("<mark c=FFBB11>" + "点击进入登陆游戏" + "</mark>");
		m_fwqTextbox_TS.setNearAnchor(m_fwqBackground01, Tools.HCENTER_BOTTOM, Tools.HCENTER_BOTTOM, 0, -5);

		m_fwqButton01 = new DWButton("刷新", m_fwqBitmap04);
//		 m_fwqButton01.setDownImage(m_fwqBitmap04);
		m_fwqButton01.addListener(new DWListener() {

			public void OnDoubleClick()
			{

			}

			public void OnClick()
			{
				if (!DWGameManager.getInstance().getSendMessage().isNetLocked(GameMessage.锁_默认)) {
					if (m_ttListbox != null) {
						m_ttListbox.removeAllSubItem();
					}
					DWGameManager.getInstance().getSendMessage().sendUserServerList();
				}
			}
		});
		m_fwqButton01.setNearAnchor(m_fwqFrame, Tools.RIGHT_BOTTOM, Tools.RIGHT_BOTTOM, -50, -20);

		m_fwqTextbox04 = new DWTextbox(null, m_fwqBackground01.getShowWidth() / 4, 0);
		m_fwqTextbox05 = new DWTextbox(null, m_fwqBackground01.getShowWidth() / 4, 0);
		m_fwqTextbox06 = new DWTextbox(null, m_fwqBackground01.getShowWidth() / 4, 0);
		m_fwqTextbox07 = new DWTextbox(null, m_fwqBackground01.getShowWidth() / 4, 0);

		m_fwqTextbox01 = new DWTextbox("<mark c=F5BA16>服务器</mark>");
		m_fwqTextbox02 = new DWTextbox("<mark c=F5BA16>角色</mark>");
		m_fwqTextbox03 = new DWTextbox("<mark c=F5BA16>状态</mark>");

		m_fwqBackground03 = new DWBackground(m_fwqBitmap06, 0, 0,
				m_fwqBackground01.getShowWidth(),
				m_fwqTextbox01.getShowHeight() + 10);
		m_fwqBackground03.setNearAnchor(m_fwqTitle, Tools.HCENTER_TOP,
				Tools.HCENTER_BOTTOM, 0, 20);

		m_ttListbox = new DWListbox(m_fwqBackground01.getShowWidth(),
				m_fwqBackground01.getShowHeight() - 125);
		m_ttListbox.setNearAnchor(m_fwqBackground03, Tools.HCENTER_TOP,
				Tools.HCENTER_BOTTOM, 0, 20);
		m_ttListbox.setLineSpacing(20);// 设置间距
		m_ttListbox.setShowBackgroundRect(false);

		switch (DWGameManager.AdpaterType) {
			case DWGameManager.AD_HIGH:
				m_fwqTextbox01.setFont(DWFont.getFont(38));
				m_fwqTextbox02.setFont(DWFont.getFont(38));
				m_fwqTextbox03.setFont(DWFont.getFont(38));
				break;
			default:
				m_fwqTextbox01.setFont(DWFont.getFont(28));
				m_fwqTextbox02.setFont(DWFont.getFont(28));
				m_fwqTextbox03.setFont(DWFont.getFont(28));
				break;
		}

		m_fwqTextbox04.setNearAnchor(m_fwqBackground03, Tools.LEFT_VCENTER, Tools.LEFT_VCENTER);
		m_fwqTextbox05.setNearAnchor(m_fwqTextbox04, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER);
		m_fwqTextbox06.setNearAnchor(m_fwqTextbox05, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER);
		m_fwqTextbox07.setNearAnchor(m_fwqTextbox06, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER);

		m_fwqTextbox01.setNearAnchor(m_fwqTextbox04, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER);
		m_fwqTextbox02.setNearAnchor(m_fwqTextbox05, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER);
		m_fwqTextbox03.setNearAnchor(m_fwqTextbox06, Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER);

		m_fwqFrame.addControl(m_fwqBackground02);
		m_fwqFrame.addControl(m_fwqBackground01);
		m_fwqFrame.addControl(m_fwqTitle);
		m_fwqFrame.addControl(m_fwqImageBox01);
		m_fwqFrame.addControl(m_fwqButton01);
		m_fwqFrame.addControl(m_ttListbox);
		m_fwqFrame.addControl(m_fwqBackground03);
		m_fwqFrame.addControl(m_fwqTextbox04);
		m_fwqFrame.addControl(m_fwqTextbox05);
		m_fwqFrame.addControl(m_fwqTextbox06);
		m_fwqFrame.addControl(m_fwqTextbox07);
		m_fwqFrame.addControl(m_fwqTextbox01);
		m_fwqFrame.addControl(m_fwqTextbox02);
		m_fwqFrame.addControl(m_fwqTextbox03);
		m_fwqFrame.addControl(m_fwqTextbox_TS);
		DWControlsManager.getInstance().addControl(m_fwqFrame);
	}

	/**
	 * 服务器列表
	 */
	DWListSubItem[] m_ttLSItem;
	DWTextbox[] m_ttTextbox01;
	DWTextbox[] m_ttTextbox02;
	DWTextbox[] m_ttTextbox03;

	DWTextbox[] m_ttTextbox04;
	DWTextbox[] m_ttTextbox05;
	DWTextbox[] m_ttTextbox06;
	DWTextbox[] m_ttTextbox07;

	DWButton[] m_ttButton_JR;

	DWImageBox[] m_ttImageBox;

	public void fuwuqiList()
	{
		if (m_ttListbox != null) {
			DWControlsManager.getInstance().removeControl(m_ttListbox);
		}
		if (m_server_list != null) {
			m_ttLSItem = new DWListSubItem[m_server_list.size()];
			m_ttTextbox01 = new DWTextbox[m_server_list.size()];
			m_ttTextbox02 = new DWTextbox[m_server_list.size()];
			m_ttTextbox03 = new DWTextbox[m_server_list.size()];
			m_ttTextbox04 = new DWTextbox[m_server_list.size()];
			m_ttTextbox05 = new DWTextbox[m_server_list.size()];
			m_ttTextbox06 = new DWTextbox[m_server_list.size()];
			m_ttTextbox07 = new DWTextbox[m_server_list.size()];
			m_ttButton_JR = new DWButton[m_server_list.size()];
			m_ttImageBox = new DWImageBox[m_server_list.size()];

			for (int i = 0; i < m_server_list.size(); i++) {
				m_ttLSItem[i] = new DWListSubItem();
				m_ttLSItem[i].setAutoWideHigh(false);
				m_ttLSItem[i].setShowWideHighUn(
						m_fwqBackground01.getShowWidth(), 34);

				m_ttTextbox04[i] = new DWTextbox(null, m_fwqBackground01.getShowWidth() / 4, 0);
				m_ttTextbox05[i] = new DWTextbox(null, m_fwqBackground01.getShowWidth() / 4, 0);
				m_ttTextbox06[i] = new DWTextbox(null, m_fwqBackground01.getShowWidth() / 4, 0);
				m_ttTextbox07[i] = new DWTextbox(null, m_fwqBackground01.getShowWidth() / 4, 0);

				m_ttImageBox[i] = new DWImageBox(m_fwqBitmap_BJ);
				m_ttImageBox[i].setNearAnchor(m_ttLSItem[i], Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER);
				m_ttImageBox[i].setShowWideHighUn(m_ttLSItem[i].getShowWidth(), m_ttLSItem[i].getShowHeight());
				m_ttImageBox[i].setTouch(false);

				m_ttTextbox01[i] = new DWTextbox(
						((Function) m_server_list.get(i)).m_name);
				int num = ((Function) m_server_list.get(i)).m_role_amount;
				String mount = "" + num;
				if (num < 1) {
					mount = "-";
				}
				m_ttTextbox02[i] = new DWTextbox(mount);
				m_ttTextbox03[i] = new DWTextbox(
						""
								+ "<mark c="
								+ getServerListColor(((Function) m_server_list
										.get(i)).m_State)
								+ ">"
								+ getServerListState(((Function) m_server_list
										.get(i)).m_State)
								+ "</mark>");

				m_ttButton_JR[i] = new DWButton("进入", m_fwqBitmap02_a);
				m_ttButton_JR[i].setTextColor(0xFFF5BA16);
				m_ttButton_JR[i].setDownImage(m_fwqBitmap02_ax);

				switch (DWGameManager.AdpaterType) {
					case DWGameManager.AD_HIGH:
						m_ttTextbox01[i].setFont(DWFont.getFont(38));
						m_ttTextbox02[i].setFont(DWFont.getFont(38));
						m_ttTextbox03[i].setFont(DWFont.getFont(38));
						break;
					default:
						m_ttTextbox01[i].setFont(DWFont.getFont(28));
						m_ttTextbox02[i].setFont(DWFont.getFont(28));
						m_ttTextbox03[i].setFont(DWFont.getFont(28));
						break;
				}

				m_ttTextbox04[i].setNearAnchor(m_ttLSItem[i],
						Tools.LEFT_VCENTER, Tools.LEFT_VCENTER);
				m_ttTextbox05[i].setNearAnchor(m_ttTextbox04[i],
						Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER);
				m_ttTextbox06[i].setNearAnchor(m_ttTextbox05[i], Tools.LEFT_VCENTER,
						Tools.RIGHT_VCENTER);
				m_ttTextbox07[i].setNearAnchor(m_ttTextbox06[i], Tools.LEFT_VCENTER,
						Tools.RIGHT_VCENTER);

				m_ttTextbox01[i].setNearAnchor(m_ttTextbox04[i], Tools.HCENTER_VCENTER,
						Tools.HCENTER_VCENTER);
				m_ttTextbox02[i].setNearAnchor(m_ttTextbox05[i], Tools.HCENTER_VCENTER,
						Tools.HCENTER_VCENTER);
				m_ttTextbox03[i].setNearAnchor(m_ttTextbox06[i], Tools.HCENTER_VCENTER,
						Tools.HCENTER_VCENTER);
				m_ttButton_JR[i].setNearAnchor(m_ttTextbox07[i], Tools.HCENTER_VCENTER,
						Tools.HCENTER_VCENTER);
				m_ttButton_JR[i].addListener(new DWListener() {

					public void OnDoubleClick()
					{

					}

					public void OnClick()
					{
						int index = m_ttListbox.getTouchIndex();
						Function server = m_server_list.get(index);
						if (DWGameManager.SERVER_PORT != server.m_port || !DWGameManager.SERVER_URL.equals(server.m_ip)) {
							DWGameManager.getInstance().closeConnection();
							DWGameManager.getInstance().setConnectionServiceInfo(server.m_ip, server.m_port);
							openConnection();
							setNextStatus(STATUS_WAIT_SERVER);
						}
						else {
							DWGameManager.getInstance().getSendMessage().sendUserReauth(
									DWGameManager.getInstance().m_rolename, m_server_session);
							m_Auth_state = true;
						}
					}
				});
				m_ttLSItem[i].addControls(m_ttImageBox[i]);
				m_ttLSItem[i].addControls(m_ttTextbox04[i]);
				m_ttLSItem[i].addControls(m_ttTextbox05[i]);
				m_ttLSItem[i].addControls(m_ttTextbox06[i]);
				m_ttLSItem[i].addControls(m_ttTextbox07[i]);
				m_ttLSItem[i].addControls(m_ttTextbox01[i]);
				m_ttLSItem[i].addControls(m_ttTextbox02[i]);
				m_ttLSItem[i].addControls(m_ttTextbox03[i]);
				m_ttLSItem[i].addControls(m_ttButton_JR[i]);
				m_ttListbox.addSubItem(m_ttLSItem[i]);
			}
		}
	}

	/**
	 * 返回服务器状态
	 *
	 * @param item
	 * @return
	 */
	public String getServerListState(int serverState)
	{
		String state = "";
		if (serverState >= 0) {
			switch (serverState) {
				case 0:
					state = "流畅";
					break;
				case 1:
					state = "火爆";
					break;
			}
		}

		return state;
	}

	/**
	 * 返回服务器状态颜色
	 *
	 * @param item
	 * @return
	 */
	public String getServerListColor(int serverState)
	{
		String color = "";
		if (serverState >= 0) {
			switch (serverState) {
				case 0:
					color = "53F007";
					break;
				case 1:
					color = "EC0D0D";
					break;
			}
		}
		return color;
	}

	/**
	 * 服务器列表返回监听
	 */
	// private DWListener m_fanhui_lis = new DWListener() {
	//
	// public void OnDoubleClick()
	// {
	//
	// }
	//
	// public void OnClick()
	// {
	// m_role_lock = true;
	// addreadserver_flag = false;
	// for (int i = 0; i < mRoleList.length; i++)
	// {
	// mRoleList[i] = null;
	// }
	// DWGameManager.getInstance().getConnection().close();
	// DWGameManager.getInstance().clearConnection();
	// DWControlsManager.getInstance().removeControl(m_fwqFrame);
	// m_rolelis_Frame = null;
	// dl_login();
	//
	// }
	// };

	/**
	 * 帮助监听
	 */
	private DWListener m_help1_lis = new DWListener() {
		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{
			UIWindows.getInstance().m_help.open((byte) 0);
		}
	};

	/**
	 * 设置监听
	 */
	public static String m_setup_ib1 = "";
	public static String m_setup_ib2 = "";
	public static boolean m_setup_flag = true;
	private DWListener m_setup_lis = new DWListener() {
		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{
//			UIWindows.getInstance().m_setup.open((byte) 0);
			setNextStatus(STATUS_SETTING);
			m_setup_ib1 = m_l_ib1.getText();
			m_setup_ib2 = m_l_ib2.getText();
			m_setup_flag = m_l_cb.getChecked();
		}
	};

	public boolean doDoubleClick(PointF point)
	{
		if (m_status == STATUS_WAIT_LOGIN || m_status == STATUS_WAIT_QUICK || m_status == STATUS_WAIT_SERVER) {
			return false;
		}
		DWControlsManager.getInstance().doDoubleClick(point);
		return false;
	}

	public boolean doLongPress(PointF point)
	{
		if (m_status == STATUS_WAIT_LOGIN || m_status == STATUS_WAIT_QUICK || m_status == STATUS_WAIT_SERVER) {
			return false;
		}
		DWControlsManager.getInstance().doLongPress(point);
		return false;
	}

	public boolean doDrag(PointF start, PointF end, float velocityX,
			float velocityY)
	{
		if (m_status == STATUS_WAIT_LOGIN || m_status == STATUS_WAIT_QUICK || m_status == STATUS_WAIT_SERVER) {
			return false;
		}
		DWControlsManager.getInstance()
				.doDrag(start, end, velocityX, velocityY);
		return false;
	}

	public boolean doDown(PointF point)
	{
		if (m_status == STATUS_WAIT_LOGIN || m_status == STATUS_WAIT_QUICK || m_status == STATUS_WAIT_SERVER) {
			return false;
		}
		DWControlsManager.getInstance().doDown(point);
		return false;
	}

	public boolean doLongScroll(PointF start, PointF end, float distanceX,
			float distanceY)
	{
		if (m_status == STATUS_WAIT_LOGIN || m_status == STATUS_WAIT_QUICK || m_status == STATUS_WAIT_SERVER) {
			return false;
		}
		DWControlsManager.getInstance().doLongScroll(start, end, distanceX,
				distanceY);
		return false;
	}

	public boolean doClick(PointF point)
	{
		if (m_status == STATUS_WAIT_LOGIN || m_status == STATUS_WAIT_QUICK || m_status == STATUS_WAIT_SERVER) {
			return false;
		}
		float pointX = point.x;
		float pointY = point.y;
		if (!DWControlsManager.getInstance().doClick(pointX, pointY)) {
		}
		return true;
	}

	public boolean doScroll(PointF start, PointF end, float distanceX,
			float distanceY)
	{
		if (m_status == STATUS_WAIT_LOGIN || m_status == STATUS_WAIT_QUICK || m_status == STATUS_WAIT_SERVER) {
			return false;
		}
		DWControlsManager.getInstance().doScroll(start, end, distanceX,
				distanceY);
		return true;
	}

	public boolean doFling(PointF start, PointF end, float velocityX,
			float velocityY)
	{
		if (m_status == STATUS_WAIT_LOGIN || m_status == STATUS_WAIT_QUICK || m_status == STATUS_WAIT_SERVER) {
			return false;
		}
		DWControlsManager.getInstance().doFling(start, end, velocityX, velocityY);
		return false;
	}

	@Override
	public void init()
	{
		if (DWGameManager.s_change_role == true) {
			DWGameManager.s_change_role = false;
			m_role_lock = true;
			DWGameManager.getInstance().getSendMessage().sendUserActorList();
			initRoleLogic();
//			if(m_l_ib1 != null && m_l_ib2 != null && m_l_cb != null)
//			{
//				m_l_ib1.setText(m_back_l_ib1);
//				m_l_ib2.setText(m_back_l_ib2);
//				m_l_cb.setChecked(m_back_status);
//			}
		}
		else {
//			DWGameActivity.instance.getSIMinfos();
			UIWindows.createInstance();
//			ParticleConstants.initResource();
			wr(DWGameActivity.instance);
			read();
		}
	}

	@Override
	public void quit()
	{
		dispose();
	}

	public Bitmap createImage(String path)
	{
		try {
			ResHead resHead = new ResHead();
			resHead.m_type = DWSerializableFactory.RESOURCE_TYPE_PNG;
			resHead.m_url = path;
			resHead.m_version = 1;
			return ((DWBitmap) ResourceManager.getInstance().loadResource(mUserResource,
					resHead)).getImage();
		}
		catch (Exception e) {
			Tools.debugPrintln("图片路径错误,加载图片失败 : " + path);
			ResHead resHead = new ResHead();
			resHead.m_type = DWSerializableFactory.RESOURCE_TYPE_PNG;
			resHead.m_url = "/img/newui/anniu_6.gnp";
			resHead.m_version = 1;
			return ((DWBitmap) ResourceManager.getInstance().loadResource(mUserResource,
					resHead)).getImage();
		}
	}

	public boolean onTouch(MotionEvent event, PointF point)
	{
		if (DWControlsManager.getInstance() != null)
			return DWControlsManager.getInstance().onTouch(event, point);
		return false;
	}

	///////////////////////////////////////////
	//网络连接
	///////////////////////////////////////////

	private DWConnectionCreator m_connectionCreator;

	public void openConnection()
	{
		if (m_connectionCreator == null
				&& (DWGameManager.getInstance().getConnection() == null || !DWGameManager.getInstance().getConnection()
						.isAlive())) {
			m_connectionCreator = new DWConnectionCreator();
			new Thread(m_connectionCreator).start();
		}
	}

	/**
	 * 处理连接异常
	 */
	public void dealForConnectionException()
	{
		String tip = "网络无法连接，请检查网络后重新进入游戏！";
		DWGameManager.getInstance().closeConnection();
		final DWMessageBox dwMB = new DWMessageBox("网络断开", tip, "确定", "退出");
		dwMB.addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWMessageBox.SOFTKEY_OK == dwMB.getResult()) {
					DWControlsManager.getInstance().removeControl(dwMB);
				}
				else if (DWMessageBox.SOFTKEY_BACK == dwMB.getResult()) {
					DWControlsManager.getInstance().removeControl(dwMB);
					DWGameManager.getInstance().destroy();
				}
			}
		});
		DWControlsManager.getInstance().addControl(dwMB);
	}
}
